Saltar para o conteúdo principal
Versão: v20 R4

4D Write Pro Interface

4D WritePro Interface offers a set of palettes, which allow end users to easily customize a 4D Write Pro document.

A 4D developer can easily implement these palettes in their application. Thus, end users can manage all 4D Write Pro properties, such as fonts, text alignment, bookmarks, table layout, and frames.

A documentação principal da interface 4D Write Pro pode ser encontrada no manual Desenho 4D.

Você encontrará abaixo a documentação de configuração do Assistente de tabelas.

Assistente de tabelas

The Table Wizard is here to further simplify table creation based on database data using contexts, data sources, and formulas.

The Table Wizard, accessible to end-users, loads templates provided and configured by 4D developers. This enables developers to customize the template according to the specific use cases and business requirements of the users.

The Table Wizard comes with default templates and themes, which developers can configure to adapt its content to match the specific requirements of the application.

To implement the Table Wizard in your application, the developers are able to create and configure template files.

WP Table Wizard interface

The user opens the Table Wizard dialog from the "Insert table" menu item in 4D Write Pro interface toolbar and sidebar.

From this interface, the user can select a template or a table from the first drop-down list and a theme from the second.

Em Colunas:

Depending on the user's selection of a template or a table, the user can view the list of fields stored in the template (Blob and object types are automatically excluded). They can then select columns to display in the table by checking the box in front of the field name and order them by moving and dragging the fields list.

Em linhas:

In the Table Wizard, the user can also define the number of header rows and extra rows (0 to 5 each), set break rows (summary rows) above or below the data row, and choose to show/hide carry-over rows.

No ecrã:

The user adjusts the zoom level according to their preference by selecting the desired option from a drop-down list, uses radio buttons to display formulas or data for clear presentation, and chooses to display a horizontal ruler using a checkbox.

After finalizing the table creation and customization, the user can click on the Insert button to add the table to their WP document.

Once the table has been integrated into the document, the user can customize its style. As ferramentas de formatação da barra de ferramentas e da barra lateral ainda estão disponíveis.

Configuração do modelo do WP Table Wizard

A configuração dos modelos inclui:

  • Defining tables and fields as well as preparing formulas adapted to the application from the template file.
  • Translating table, field, and formula names from the translation file.
  • Designing graphic styles and customized themes from the theme file.

These three types of files contribute to the configuration of the Table Wizard, and while each serves a distinct purpose, none of them are considered essential components.

Arquivos de modelo

O ficheiro modelo permite-lhe definir o seguinte:

  • a fórmula que retorna uma seleção de entidades usadas como fonte de dados para a tabela,
  • as fórmulas de interrupção (se for possível inserir uma linha de interrupção)
  • os atributos dataclass que podem ser usados como colunas da tabela,
  • the formulas available as contextual menus inside break rows, carry-over row or extra rows.
Limitação

In the current implementation (4D v20 R2), formulas in breaks, data sources and contextual menus do not support calls to the host database methods. Esta limitação será eliminada na próxima versão.

The template file must be stored in a "Resources/4DWP_Wizard/Templates" folder within your project.

O arquivo de modelo no formato JSON contém os seguintes atributos:

AtributoTipoObrigatórioDescrição
tableDataSourceTextxFórmula da fonte de dados da tabela
columnsCollectionxColeção de colunas de tabela
columns.checkTextxTrue quando a coluna já está selecionada no editor de modelos. False quando a coluna não está selecionada no editor de modelos.
columns.headerTextxEtiqueta mostrada ao usuário
columns.sourceTextxFormula
breaksCollectionCollection of break objects. A ordem das interrupções é importante. It corresponds to the order in the document when the breaks are above the data lines.
breaks.labelTextxEtiqueta mostrada ao usuário
breaks.sourceTextxFormula
breakFormulasCollectionColeção de objetos de fórmula aplicáveis a linhas de quebra
breakFormulas.labelTextxEtiqueta mostrada ao usuário
breakFormulas.sourceTextxFormula
bcorFormulasCollectionCollection of formula objects applicable to bottom carry over rows
bcorFormulas.labelTextxEtiqueta mostrada ao usuário
bcorFormulas.sourceTextxFormula
extraFormulasCollectionColeção de objetos de fórmula aplicáveis a linhas extras
extraFormulas.labelTextxEtiqueta mostrada ao usuário
extraFormulas.sourceTextxFormula
idioma francês

If your application is likely to be run on a 4D with language set to French, make sure that you use tokens in your formulas so that they are correctly interpreted no matter the user's language configuration.

Exemplo

Eis um breve exemplo do aspeto do seu ficheiro JSON:

{
"tableDataSource": "ds.People.all().orderBy(\"toCompany.name asc, continent asc, country asc, city asc\")",
"columns": [{
"check": true,
"header": "Firstname",
"source": "This.item.firstname"
}, {
"check": true,
"header": "Lastname",
"source": "This.item.lastname"
}, {
"check": true,
"header": "Salary",
"source": "String(This.item.salary;\"###,###.00\")"
}
],
"breaks": [{
"label": "Company",
"source": "This.item.toCompany.name"
}
],
"breakFormulas": [{
"label": "Empresa",
"fonte": "This.item.toCompany.name"
}, {
"label": "Soma dos salários",
"source": "String(This.breakItems.sum(\"salary\"); \"###,###.00\")"
}
],
"bcorFormulas": [{
"label": "Soma dos salários",
"source": "String(This.tableData.sum(\"salary\"); \"###,###.00\")"
}
],
"extraFormulas": [{
"label": "Soma dos salários",
"source": "String(This.tableData.sum(\"salary\"); \"###,###.00\")"
}
]
}

Arquivos de tradução

Translation files translate the names of templates, themes, tables, fields, and formulas. These files are added to the "Resources/4DWP_Wizard/Translations" folder in your project.

Each translation file must be named with the corresponding language code (for example "en" for English or "fr" for French).

O arquivo de tradução no formato JSON contém os seguintes atributos:

AtributoTipoObrigatórioDescrição
tabelasCollectionColeção de objetos de tabela traduzidos
fieldsCollectionColeção de objetos de campo traduzidos
formulasCollectionColeção de objetos fórmula traduzidos
fileNamesCollectionCollection of translated fileName objects (applicable to the theme and template name)

Whitin each one of these attribute, the translation object includes the following attributes:

AtributoTipoObrigatórioDescrição
originalTextxTexto original destinado à tradução
translationTextxVersão traduzida do texto original

Defining these attributes within the translation object ensures proper organization and alignment between the source and translated content.

If the template name or the formula (break, carry-over row, or extra) exists in the translated file, its translation is applied in the Table Wizard. In addition, only the table defined within the translation file is displayed and translated.

The translation file serves an additional role when a user selects a table in the interface. Ele pode filtrar as tabelas e os campos propostos ao usuário. For example, to hide table IDs, this behavior is similar to the SET TABLE TITLES and SET FIELD TITLES commands.

Exemplo
{
"tables": [{
"original": "People",
"translation": "Personne"
}
],
"fields": [{
"original": "lastname",
"translation": "Nom"
}, {
"original": "firstname",
"translation": "Prénom"
}, {
"original": "salary",
"translation": "Salaire"
}, {
"original": "company",
"translation": "Société"
}
],
"formulas": [{
"original": "Sum of salary",
"translation": "Somme des salaires"
}
]
}

Arquivos de temas

A list of themes is provided by default in the 4D Write Pro Interface component, such as "Arial", "CourierNew" and "YuGothic", available in multiple variations like "Blue" and "Green". However, you can create your own theme by placing it in the "Resources/4DWP_Wizard/Themes" folder within your project.

O ficheiro de tema em formato JSON contém os seguintes atributos:

AtributoTipoObrigatórioDescrição
defaultObjectObjeto que contém o estilo padrão aplicável a todas as linhas.
tabelaObjectObjeto que contém a definição de estilo aplicável à tabela.
rowsObjectObjeto que contém a definição de estilo aplicável a todas as linhas.
cellsObjectObjeto que contém a definição de estilo aplicável a todas as células.
header1ObjectObjeto que contém a definição de estilo aplicável à primeira linha de cabeçalho.
header2ObjectObject containing the style definition applicable to the second header row.
header3ObjectObjeto que contém a definição de estilo aplicável à terceira linha de cabeçalho.
header4ObjectObject containing the style definition applicable to the fourth header row.
header5ObjectObjeto que contém a definição de estilo aplicável à quinta linha de cabeçalho.
headersObjectObject containing the style definition applicable to the header rows, if a specific header (like header1, header2...) is not defined.
dataObjectObject containing the style definition applicable to the repeated data row.
break1ObjectObjeto que contém a definição de estilo aplicável à primeira linha de quebra.
break2ObjectObjeto que contém a definição de estilo aplicável à segunda linha de quebra.
break3ObjectObjeto que contém a definição de estilo aplicável à terceira linha de quebra.
break4ObjectObjeto que contém a definição de estilo aplicável à quarta linha de quebra.
break5ObjectObjeto que contém a definição de estilo aplicável à quinta linha de quebra.
breaksObjectObject containing the style definition applicable to the break rows, if a specific break (like break1, break2...) is not defined.
bcorObjectObject containing the style definition applicable to the bottom carry-over row.

For every attribute used in your JSON file (header, data, carry-over, summary, and extra rows), you can define the following WP attributes, mentionned with their corresponding WP constant:

Atributos WPConstante WP correspondente
textAlignwk text align
backgroundColorwk background color
borderColorwk border color
borderStylewk border style
borderWidthwk border width
fontwk font
colorwk font color
fontFamilywk font family
fontSizewk font size
paddingwk padding
Exemplo
{
"default": {
"backgroundColor": "#F0F0F0",
"borderColor": "#101010",
"borderStyle": 1,
"borderWidth": "0.5pt",
"font": "Times New Roman",
"color": "#101010",
"fontFamily": "Times New Roman",
"fontSize": "7pt",
"padding": "2pt"
},
"table": {
"backgroundColor": "#E1EAF3"
},
"header1": {
"textAlign": 2,
"borderColor": "#41548F",
"borderWidth": "1.5pt",
"backgroundColor": "#979BA9",
"color": "#F4F4FF",
"font": "Times New Roman Bold"
},
"data": {
"fontSize": "13pt",
"textAlign": 0
},
"break1": {
"textAlign": 2,
"fontSize": "15pt"
}
}

Veja também

4D Write Pro - Assistente de tabelas (vídeo tutorial)