21.2.7. 表项

您可以使用表项来装饰和解释地图:

  • Attribute table :根据预定义的规则显示层的属性子集

  • Fixed table :插入手动文本表,其中的信息可以独立于层。

21.2.7.1. 属性表项

项目中的任何层都可以在打印版面中显示其属性。使用 添加表格 Add Attribute Table 刀具随动 items creation instructions 添加新的表项,以后可以使用与在中公开的相同方式操作该表项 与布局项目交互

By default, a new attribute table item loads first rows of the first (alphabetically sorted) layer, with all the fields. You can however customize the table thanks to its Item Properties panel. Other than the items common properties, this feature has the following functionalities (see 图 21.38):

../../../../_images/attribute_properties.png

图 21.38 属性表项属性面板

主要属性

The Main properties group of the attribute table provides the following functionalities (see 图 21.39):

../../../../_images/attribute_mainproperties.png

图 21.39 属性表主属性组

  • Source 默认情况下,您只能选择 Layer features 允许您选择一个 Layer 从项目中加载的矢量层。

    The 数据定义 Data-defined override button near the layer list allows you to dynamically change the layer which is used to populate the table, e.g. you could fill the attribute table with different layer attributes per atlas page. Note that the table structure used (图 21.42) is the one of the layer shown in the Layer drop-down list and it is left intact, meaning that setting a data defined table to a layer with different field(s) will result in empty column(s) in the table.

    如果您激活了 复选框 :guiabel:在中生成图集`选项 :guilabel:`Atlas 面板(请参见 生成地图集 ),还有另外两个 Source 可能:

    • Current atlas feature (see 图 21.40): you won't see any option to choose the layer, and the table item will only show a row with the attributes from the current feature of the atlas coverage layer.

    • and Relation children (see 图 21.41): an option with the relation names will show up. This feature can only be used if you have defined a relation using your atlas coverage layer as parent, and the table will show the children rows of the atlas coverage layer's current feature.

  • 按钮 Refresh Table Data 可用于当表的实际内容发生更改时刷新表。

../../../../_images/attribute_mainatlas.png

图 21.40 属性表‘当前地图集要素’的主要属性

../../../../_images/attribute_mainrelation.png

图 21.41 关系子项的属性表主要属性

  • The button Attributes... starts the Select Attributes dialog, (see 图 21.42) that can be used to change the visible contents of the table. The upper part of the window shows the list of the attributes to display and the lower part helps you sort the data.

    ../../../../_images/attribute_select.png

    图 21.42 属性表选择属性对话框

    Columns 部分,您可以:

    • 在列表中向上或向下移动属性,方法是选择行,然后使用 向上箭头向下箭头 按钮来移动行。可以一次选择和移动多行。

    • 属性添加一个属性 符号系统添加 纽扣。这将在表的底部添加一个空行,您可以在其中选择要作为属性值的字段或通过正则表达式创建属性。

    • 属性移除属性 符号系统移除 纽扣。可以一次选择和删除多行。

    • 将属性表重置为其默认状态 Reset 纽扣。

    • 使用清除该表 Clear 纽扣。当您有一个很大的表,但只想显示少量属性时,这很有用。清除表格并添加所需的行可能会更快,而不是手动删除每一行。

    • 单元格标题可以通过将自定义文本添加到 Heading 纵队。

    • 单元格对齐方式可以使用 Alignment 列,该列将指定文本在表格单元格中的位置。

    • 单元格宽度可以通过将自定义值添加到 width 纵队。

    Sorting 部分,您可以:

    • 添加用于对表进行排序的属性:按 符号系统添加 按钮,并添加一个新的空行。将字段或表达式插入 Attribute 列,并将 Sort orderAscendingDescending

    • 在列表中选择一行,然后使用 向上箭头向下箭头 按钮以更改属性级别的排序优先级。在中选择单元格 Sort Order 列可帮助您更改属性字段的排序顺序。

    • 使用 符号系统移除 按钮可从排序列表中删除属性。

特征过滤

The Feature filtering group of the attribute table provides the following functionalities (see 图 21.43):

../../../../_images/attribute_filter.png

图 21.43 属性表要素过滤组

你可以:

  • 定义 Maximum rows 以供展示。

  • 激活 复选框 Remove duplicate rows from table 仅显示唯一记录。

  • 激活 复选框 Show only visible features within a map 并选择相应的 Linked map 其可见特征属性将被显示。

  • 激活 复选框 Show only features intersecting Atlas feature 仅在以下情况下可用 复选框 Generate an atlas 已被激活。激活后,它将显示一个表格,其中只包含与当前地图集要素相交的要素。

  • 激活 复选框 Filter with 并通过在输入行中键入或使用给定的 表达式 表达式按钮。以下是从示例数据集中加载Airways图层时可以使用的几个过滤语句示例:

    • ELEV > 500

    • NAME = 'ANIAK'

    • NAME NOT LIKE 'AN%'

    • regexp_match( attribute( $currentfeature, 'USE' )  , '[i]')

    最后一个正则表达式将只包括属性字段“Use”中包含字母“I”的机场。

外观

The Appearance group of the attribute table provides the following functionalities (see 图 21.44):

../../../../_images/attribute_appearance.png

图 21.44 属性表外观组

  • 单击 复选框 Show empty rows 使用空单元格填充属性表。当您要显示结果时,此选项还可用于提供额外的空单元格!

  • 使用 Cell margins 您可以在表格的每个单元格中定义文本周围的边距。

  • 使用 Display header 您可以从列表中选择“在第一帧上”、“在所有帧上”默认选项或“无标题”中的一个。

  • 该选项 Empty table 控制当结果选择为空时将显示的内容。

    • Draw headers only ,将仅绘制页眉,除非您已为 Display header

    • Hide entire table ,将只绘制表格的背景。您可以激活 复选框 Don't draw background if frame is empty 在……里面 Frames 把桌子完全隐藏起来。

    • Show set message ,将绘制标题并添加跨越所有列的单元格,并显示可在选项中提供的消息,如‘No Result’ Message to display

  • 该选项 Message to display 仅当您选择了 Show set messageEmpty table 。当结果为空表时,所提供的消息将显示在第一行的表中。

  • With Background color you can set the background color of the table using the color selector widget. The Advanced customization option helps you define different background colors for each cell (see 图 21.45)

../../../../_images/attribute_background.png

图 21.45 属性表高级背景对话框

  • 复选框 Apply layer conditional styling colorsconditional table formatting 在层中应用布局属性表(背景颜色、字体系列和属性,如粗体、斜体、删除线、下划线、颜色等)。条件格式规则优先于其他布局表格格式设置,例如,它们将覆盖其他单元格背景颜色设置,如交替行颜色。

  • Wrap text on 选项,您可以定义一个字符,每次满足单元格内容时都将在该字符上对其进行包装

  • 使用 Oversized text 您可以定义当为列设置的宽度小于其内容长度时的行为。它可以是 Wrap textTruncate text

备注

中描述了属性表项的更多属性 表常见功能 一节。

21.2.7.2. 固定表项

有关地图的其他信息可以手动插入到表中,方法是选择 添加手动表格 Add Fixed Table 并通过以下方式 items creation instructions 添加新的表项,以后可以使用与在中公开的相同方式操作该表项 与布局项目交互

默认情况下,地图布局中会显示一个空表,其中包含两个最小化的列和行。您必须在 Item Properties 面板。而不是 items common properties ,此功能具有以下功能:

主要属性

../../../../_images/fixedtable_table_designer.png

图 21.46 带有表设计器的固定表项属性面板

在……里面 Main properties 您可以使用 Table designer 当单击 Edit table ...

  • 您可以单击表并手动插入文本。

  • 通过顶部的菜单,可以执行以下操作:

    • Import Content From Clipboard 通过转到 File (它覆盖给定的输入)。

    • 通过转到使用行和列的选择功能 Edit

    • Insert rowsInsert columnsDelete RowsDelete Columns 以及使用选项来 复选框 Include Header Row

  • 您可以使用 Cell Contents 右侧的部分和:

    • 定义中选定单元格的文本格式 Formatting

      • 通过单击给定的 表达式 表达式按钮,并使用正则表达式作为单元格的输入

      • 通过选择 Text format

      • 通过 复选框 Format as number (有多种格式可供选择)

      • 通过定义 Horizontal alignment 以及 Vertical alignment

      • 通过选择一个 Background color

    • 定义 Cell Size 使用 Row heightColumn width

外观

这个 Appearance 固定工作台组提供以下功能:

  • 单击 复选框 Show empty rows 使用空单元格填充属性表。

  • 使用 Cell margins 您可以在表格的每个单元格中定义文本周围的边距。

  • 使用 Display header 您可以从列表中选择“在第一帧上”、“在所有帧上”默认选项或“无标题”中的一个。

  • 使用 Background color 属性设置表格的背景色。 color selector 小工具。这个 Advanced customization 选项可帮助您为每个单元格定义不同的背景色。

  • 使用 Oversized text 您可以定义当为列设置的宽度小于其内容长度时的行为。它可以是 Wrap textTruncate text

备注

中描述了固定表项的更多属性 表常见功能 一节。

21.2.7.3. 表常见功能

显示网格

The Show grid group of the table items provides the following functionalities (see 图 21.47):

../../../../_images/attribute_grid.png

图 21.47 属性表显示格网编组

  • 激活 复选框 Show grid 当您要显示网格时,表格单元格的轮廓。您也可以选择 Draw horizontal linesDraw vertical lines 或者两者都有。

  • 使用 Line width 您可以设置网格中使用的线条的粗细。

  • 这个 Color 可以使用颜色选择小部件设置网格的大小。

字体和文本样式

The Fonts and text styling group of the table items provides the following functionalities (see 图 21.48):

../../../../_images/attribute_fonts.png

图 21.48 属性表字体和文字样式组

  • 你可以定义 Font 的属性 Table headingTable contents ,使用高级 text settings 微件(具有缓冲区、阴影、Paint Effects、透明度、背景、着色等...)。请注意,这些更改不会影响分配了自定义字体的单元格,无论是从 Appearance 部分或 Table Designer 对话框中。只有具有默认呈现的单元格才会被覆盖。

  • For Table heading you can additionally set the Alignment to Follow column alignment or override this setting by choosing Left, Center or Right. The column alignment is set using the Select Attributes dialog (see 图 21.42 ).

The Frames group of the table item properties provides the following functionalities (see 图 21.49):

../../../../_images/attribute_frame.png

图 21.49 属性表框组

  • 使用 Resize mode 您可以选择如何呈现属性表内容:

    • Use existing frames 仅在第一帧和添加的帧中显示结果。

    • Extend to next page 将根据需要创建尽可能多的框架(和相应的页面),以显示完整的属性表选择。每个框架都可以在布局上四处移动。如果调整框架的大小,则生成的表格将在其他框架之间分割。最后一帧将被修剪以适合桌子。

    • Repeat until finished 还将创建与 Extend to next page 选项,除非所有帧都具有相同的大小。

  • 使用 Add Frame 按钮添加与所选框架大小相同的另一个框架。使用调整大小模式时,无法放入第一帧的表的结果将在下一帧中继续 Use existing frames

  • 激活 复选框 Don't export page if frame is empty 防止在表格框架没有内容时导出页面。这意味着所有其他布局项目、地图、比例尺、图例等将在结果中不可见。

  • 激活 复选框 Don't draw background if frame is empty 防止在表格框架没有内容时绘制背景。