Printing in ClassiX
This documentation is intended to familiarise the ClassiX user with the interaction between Word and ClassiX printing. Thus, it is first explained which Word documents are involved in printing and how, before the structure of a print form is described. In this context, Word's access to information from the database is explained using selected examples.
Knowing which changes in the Word documents cause which changes in the printout of a form should be the general goal of this documentation.
1. working with Word | |
1. working with Word
1.1 OleBox
The OleBox creates the interface between ClassiX and the Word and Excel documents. By double-clicking on a displayed OLE object #01, the corresponding application is started and the OLE object can be edited in it.
Similar to an MLString widget #02, the MLOleBox is also multilingual. The language can be changed with the PgUp/PgDown keys. For orientation, the current language is shown in the upper right corner of the widget by the country code (changeable in locales.txt).
Tip:
An OleBox accepts the dropping of OLE objects. This means that you can also drag and drop an MS Word file that you are editing outside the ClassiX database into an OleBox.
After editing a Word document, there are several ways to save the Word document and return to ClassiX. The "more correct" ways are via the menu (File -> Close) or via the close cross.
The Word documents behind an OleBox can also contain document variables, which are described in a later section. If the information behind these fields is updated, you can also update the view of the OleBox. This is done with the Refresh button. |
1.2 Style sheet
In order to realise a uniform appearance of the Word documents, ClassiX takes advantage of the format template.
A style sheet is a set of formatting attributes that can be applied to the text in the document to quickly change its appearance. When you assign a style, you apply a group of formatting features in one step.
When you start Microsoft Word, the new blank document is based on the Normal template, and the text you enter uses the Standard style sheet. When you start typing, Word uses the font, font size, line spacing, text alignment, and other formats that are currently defined for the Standard style template.
Since the style sheet, which has a different characteristic on each computer, is stored locally, the Word documents created at different workstations also differ. In addition to the effect of creating a variety of different formats, the following problem arises.
Word texts are also inserted into other documents during printing. This is done using the copy function of Word. However, since only the contents and significant format changes are copied, the appearance of the Word text may change in print.
Example:
When copying a Word text, only the content and the additional formats are transferred. Thus, the font size and the addition "Bold" is also transferred to the document2, but the font of the copied section is now "Times New Roman".
To avoid this problem, when a new Word document is created from within ClassiX, a separate style sheet is assigned that is the same for all. This template ("classix.dot") is located in the /ClassiX/system directory. If, for example, all new Word documents are to be created in font size 12, this must simply be defined in classix.dot.
2. classification of the Word documents
2.1 Master data documents
Master data documents are used in ClassiX to describe the object they are held by. This type of Word document is used, for example, to describe sales items or conditions in more detail. Master data documents are reproduced 1 to 1 in the printout, as they usually contain only plain text.
2.2 Cover letter and footer documents
These Word documents are used, for example, in quotations and purchase orders and, in addition to pure text, also contain fields #03, which are filled with information by ClassiX. Thus, it is not necessary for the processor of an offer to constantly put his name under each offer. Instead, he can define a field which reads out this information for him from the database and prints it out in the form.
2.3 Text blocks
Text modules are mainly used when creating an activity document, such as a letter. However, they are different from the documents used for printing complicated forms. Whereas a form is made up of several modules, an activity document is basically made up of only one Word document.
Text modules are the template for an activity document. When you create a document, only one copy of the text module is created at a time, which is then used for further processing. Text modules therefore contain almost exclusively fields, since the text is then inserted into the copy by the user.
2.4 Document modules
Document modules are used to build a complex form. However, they only consist of fields or text that is the same for all printouts. Unlike the copies of the text modules, the user then has no more influence on the Word documents.
While in the text modules only text information is inserted into the document, whole Word documents are also read in the document modules. These are mainly master data documents.
3. forms overview
3.1 Form
A form is described by the document modules as well as by the margin settings and the document type, etc. The form can be differentiated by type. Forms can differ in type and be assigned to areas:
The document modules from which the form is constructed are specified in the forms. The sequence of the modules usually determines the structure of the form. However, there are exceptions. For example, there is a fixed predefined sequence in the offer, which cannot be changed by the arrangement of the modules. Likewise, the headers and footers as well as the carryovers are understandably repeated on each page, regardless of their position in the list of modules.
3.1.1 Tree representation
3.1.2 Exporting and importing forms
The export and import of forms has the following useful advantages. For example, you can save/archive forms outside the database or change them in a test system and transfer them to the running system via export/import.
The descriptive files (*.fcp and *.for) for the forms are usually located in the directory drive letter:\Classix\Project name\AppsWH\Data\Forms\Project name\.
The document modules used are usually located in the directory drive letter:\Classix\Project name\AppsWH\Data\Forms\Project name\Docs
In the 'YXZ.for' you will find the details of the document. That is, the name of the form and the modules from which it is constructed.
In the 'YXZ.fcp', the specifications for the document modules are then specified accordingly.
The remaining files are the Word documents that belong to the building blocks. If a file name consists of two numerical values, it is a simple module. In this case, the first value describes the ID and the second value the language. Otherwise, it is a conditional block. While the first value still describes the ID, the second value stands for the condition and only the third value for the language. |
The difference between simple and conditional document modules is explained in the following section.
3.2 Document blocks
The document modules are the enveloping objects for the Word documents that are used when a form is printed. In addition to the Word documents, they hold information such as ID, name, type, and the type of module. In addition, you can insert submodules that are to be included in the print module in the order in which they are listed in the submodule list.
3.2.1 Conditional document modules
The following example may serve to deepen your understanding. Document headers in ClassiX are usually made up of
Conditional building blocks built. There is a Word document, which is used for the first page and one for the following pages depending on the client logged on.
The access expression print.counter is generally used to access the current page number.
Accordingly, the condition print.counter=1 returns TRUE if the first page is currently being printed. How the next conditions are structured is explained in one of the next sections. But you can see that you can also logically link two conditions. So the next condition returns a TRUE only if both the part
var(cyberEnterprise).uniqueID=“002“
as well as the part
print.counter>1
is fulfilled.
It is important to note that only one Word document can be returned at a time.
If two conditions are met, only the Word document of the upper position is returned. Therefore, it can be advantageous to be able to move the positions using the arrows to the right of the table.
3.2.2 Exporting and Importing Document Modules
The export of document modules is similar to the export of documents. To export, select the modules in the corresponding selection window and click on "Edit -> Data exchange -> Export". The file dialog opens and you can choose the location and the name of the file. By default, component.fcp is suggested here.
4. dynamic data fields
The connection of the module to the ClassiX system is created by inserting document variables. This is done via the menu Insert/Quick modules/Field (Word 2013). A window opens in which the desired field can be selected. The document variable can be found under the category Document Automation as the field name DocVariable. By pressing the button 'OK' a new document variable is created. The entry { DOCVARIABLE \*MERGEFORMAT} is inserted in the document. The tick in the checkbox can usually be removed. If it is left in, it ensures that the content of the DocVariable is output uniformly. In Word there are two modes for displaying DocVariables. You can switch between the detailed {DOCVARIABLE ID \*MERGEFORMAT} and the abbreviated mode << ID >> with the key combination Alt+F9. If you are in verbose mode, you can also create the double curly brackets with Ctrl+F9 and then write DOCVARIABLE into them. You should never write the curly braces as curly brackets {}, because Word does not recognize this. |
From now on there are different ways to access information from the ClassiX database. When printing, at least one object is always transferred to Word. This means that you can access all the information of this object and the objects that are linked to the source object via an access printout.
Example:
When printing an order, the order number should be output.
{ DOCVARIABLE uniqueID }
Now the project name should also be printed.
{ DOCVARIABLE costObjectivePointer.shortName }
This method can be used to output not only simple text or numerical values, but also Word texts, such as those used for condition and sales article descriptions. Word objects are always accessed via an access expression that ends in mlWordDoc. Just like multilingual texts that are accessed via mlDescription, the language valid for the document is always returned and inserted at the position of the field.
Example:
Printing a sales item description from a quotation.
{ DOCVARIABLE salesItem.mlWordDoc }
Printing the multilingual article text in an order item
{ DOCVARIABLE itemPointer.mlDescription }
A second possibility is to access variables used in ClassiX. For example, there are variables that always describe the same thing. cyberEnterprise always holds the object of the logged-in client, user always represents the logged-in user and printObject is always the object that is currently being printed. In addition, there are variables that are only sometimes used. For example, when printing a purchase order, the variable tmpCondition can be used to read information from the condition that is currently being printed.
Examples:
The client is automatically indicated in the letter of offer.
With kind regards
{ DOCVARIABLE var(cyberEnterprise).partner.name }
You could also print the initials of the logged on user.
{ DOCVARIABLE var(user).uniqueID }
However, these two methods have their limits if you want to output the values of a collection #04 or if you have complicated access expressions that cannot be displayed in Word. ClassiX offers the possibility to access macros defined in the modules directly. The object to be printed is transferred to the macro via the field name call (macro name) and the code behind it is executed. It is important that the macro is also defined in one of the modules involved in printing. A value must always be returned, usually this should be a string.
Examples:
When printing an offer, the article number should be printed. If the article is a variant part, the number should be replaced by the text "ATTENTION!{ DOCVARIABLE call(PrintItemNumber)}
}
;
In conjunction with the methods presented so far to access information, there is also the possibility of using the ClassiX basic methods that the object to be printed brings with it.
Examples:
When printing a quotation item, data from the quotation header is to be accessed.
{ DOCVARIABLE TopTransaction().uniqueID }
In this example, you can use the fact that the object of the quotation item has the TopTransaction method, which returns the object of the quotation header and which you can use to access the ID.
When calling methods where parameters are written with quotation marks, these must be replaced by inverted commas.
Examples:
When printing one of the storage bins using a dimension ( CX_STOCK_SPACE ).
{ DOCVARIABLE stockSpaceItemAccount.Dimension('CX_STOCK_SPACE').uniqueID }
InstantView procedures can also be called from the document, module or provider. These must be called as usual with a "call()" in the access path.
Examples:
Here the name of the user is converted into an XML format .
{ DOCVARIABLE var(user).Speech(0,0,8).call(webService::XMLEncode) }
In connection with the document variables, you can also use additional field functions of Word. One of the most important of these is the IF condition. This branching option is always structured according to the following scheme.
{ IF condition "statement for true" "statement for false" }
It is also possible to access information in these fields via the DocVariables. It is important to use double quotation marks in the conditions. But not only IF conditions but also formula expressions, etc. can be used.
Example:
The technical administrator is to be printed in an offer. If this person is not specified, the business administrator is to be printed.
{ IF "{ DOCVARIABLE technical.personInCharge.name }" = " " "{ DOCVARIABLE personInCharge.name }" "{ DOCVARIABLE technical.personInCharge.name }" }
Another possible use of IF conditions is that they can be used to avoid unnecessary blank lines. The following example shows this.
Example:
{ IF "{ DOCVARIABLE technical.personInCharge.name }" = " " "" "¶
{ DOCVARIABLE technical.personInCharge.name }" }{ IF "{
DOCVARIABLE personInCharge.name } " = " " "" "¶
{ DOCVARIABLE personInCharge.name }" }Here, the technical administrator is printed in the first condition. The line is only wrapped if he or she really exists. The same applies to the business administrator. If he or she does not exist, we are still in the line in which the technical SB was printed. Otherwise, it is printed in the next line.
By default, only the DOCVARIABLEs are evaluated directly in ClassiX and the other fields are processed by the word processing programme used, such as Microsoft Word. However, not all word processing programmes support all fields, which is why the environment variable CX_WORD_XML_MERGE_MODE(235443) can be used to control whether the IF, COMPARE, =AND and =OR fields should also be evaluated by ClassiX before printing in addition to the DOCVARIABLE field. This means that these fields can also be used in the documents if the word processing programme does not support these fields, or only supports them to a very limited extent. LibreOffice, for example, does not support the formatting of IF fields in the result. However, since the direct evaluation of the IF fields in ClassiX is somewhat more limited than the evaluation of Microsoft Word (see CX_WORD_XML::Merge), it is recommended to change the merge mode only if the premature evaluation of the fields is required.
5. common problems and questions
IF conditions are not interpreted correctly by Word | |||
| Here it can help to put the condition blocks, which are to be compared with each other, in quotation marks. Sometimes this is even mandatory. If a condition expression is to be compared with NOTHING, a space must be inserted between the quotation marks. { IF "EXPRESSION" = " " .... } | ||
Word terminates with error message when printing | |||
| with the old printing method, cells of a table cannot be connected vertically. | ||
Changes not possible | |||
| There may be a syntax error in the document variables. To find the incorrect document, you can use the title of the print window. | ||
| There are too many Word documents in the corresponding TEMP folder, which were created by Word itself. You should simply delete them to fix this. | ||
Text blocks look different in the printout than in ClassiX. | |||
| You should check whether the document module and any Word documents involved have the same format templates (see Section 1.2) | ||
6 . tips and tricks
- Tables without margins help with the positioning of texts, list headers and lists. To edit the contents of these tables, the margins can be displayed as auxiliary lines. (Word 2013: In the menu bar the menu item "Table tools" is available for a table and is marked in colour. If you select the "Layout" sub-item you can activate the "Show grid lines" function on the left-hand side)
- With logos, care should be taken to ensure that they have the formatting "With text in line". Logos should also be in a table without margins. However, the context menu item for changing the formatting is only offered if the logo is outside the table.
1 OLE ("Object Linking and Embedding") has become known as a Microsoft-developed standard for compound documents based on the COM specification. COM is the abbreviation for "Component Object Model".
3 fields are used as placeholders for changing data in a document or to create mail merge and labels in mail merge documents
4 Collection of objects in ClassiX that are attached to an access expression