Adding Custom Rendering Layouts
COSMO Document Configurator uses RDLC layouts to render reports. Which RDLC layout is used for rendering is defined by the enum CCS DC Rendering Layout
configured on the Document Layout page. To add custom RDLC layouts, you can extend the enum programmatically by creating an enum extension and implementing the interface CCS DC Rendering Layout Information
as described below.
Copy an existing RDLC layout
When adding a custom rendering layout, it is recommended to copy an existing RDLC layout included in COSMO Document Configurator and modify it to your needs. To export a RDLC layout from COSMO Document Configurator, navigate to the Report Layouts page and select the layout you want to export. Then click the Export Layout button to download the RDLC layout as a file. The following RDLC layouts are included in COSMO Document Configurator:
Rendering Layout | Report ID | Report Name |
---|---|---|
A4 Portrait Flow Layout | 12032040 | DC - A4 Portrait |
A4 Portrait Fixed Layout | 12032027 | DC - A4 Portrait |
A4 Landscape Fixed Layout | 12032028 | DC - A4 Landscape |
Letter Portrait Fixed Layout | 12032029 | DC - Letter Portrait |
Letter Landscape Fixed Layout | 12032030 | DC - Letter Landscape |
Label (57 x 102 mm) | 12032032 | DC - Label (57 x 102 mm) |
Extending the enum CCS DC Rendering Layout
Create a new enum extension and add a new value representing your custom RDLC layout. The value must implement the interfaces CCS DC Rendering Layout Information
and CCS DC Rendering Layout Text Processor
:
- As an implementation for the interface
CCS DC Rendering Layout Text Processor
choose eitherCCS DC Flow Layout
orCCS DC Fixed Layout
, depending on whether the custom layout is based on a flow layout or on a fixed/classic layout. - As an implementation for the interface
CCS DC Rendering Layout Information
enter a codeunit of your extension, in which this interface will be implemented in the next section.
enumextension [your object ID] [your object name] extends "CCS DC Rendering Layout"
{
value([your value ID]; [your value name])
{
Caption = 'Your value caption';
Implementation = "CCS DC Rendering Layout Text Processor" = ["CCS DC Flow Layout" | "CCS DC Fixed Layout"],
"CCS DC Rendering Layout Information" = [your implementation codeunit];
}
}
Implementing the interface CCS DC Rendering Layout
In the codeunit you have specified in the enum extension, implement the interface CCS DC Rendering Layout Information
and add the following methods:
GetRenderingLayoutBlob(RenderingLayout: Enum "CCS DC Rendering Layout"; var TempBlob: Codeunit "Temp Blob"): Boolean
This method must return the RDLC layout as a blob. The parameterRenderingLayout
contains the enum value of the custom layout(s). The parameterTempBlob
is a temporary blob, which must be filled with the RDLC layout. The method must returntrue
if the RDLC layout was found andfalse
if not.
It is up to you where to store the RDLC layout. You can e.g.- Create a new blob field in a setup table where you upload the RDLC layout via the UI and then read it from there, or
- Include the RDLC layout in your extension by linking it to a report object and use the method
GetDefaultLayoutBlob(ReportId: Integer; var TempBlob: Codeunit "Temp Blob"): Boolean
of the codeunitCCS DC Management
to get the RDLC layout as a blob.
GetRenderingLayoutType(RenderingLayout: Enum "CCS DC Rendering Layout"): Enum "Custom Report Layout Type"
This method must return the custom report layout type, which can be eitherRDLC
orWord
. Since currently only RDLC layouts are supported, this method must always returnRDLC
.GetPageHeight(RenderingLayout: Enum "CCS DC Rendering Layout"): Integer
If the custom RDLC layout is based on a fixed layout, this method must return the number of lines per page. If the custom RDLC layout is based on a flow layout, this method must return0
. For the included fixed layouts, the following values are used:- A4 Portrait Fixed Layout:
61
- A4 Landscape Fixed Layout:
38
- Letter Portrait Fixed Layout:
56
- Letter Landscape Fixed Layout:
41
- Label (57 x 102 mm):
25
- A4 Portrait Fixed Layout:
GetPageWidth(RenderingLayout: Enum "CCS DC Rendering Layout"): Integer
This method must return the usable width of the layout in pt. For the included RDLC layouts, the following values are used:- A4 portrait:
508
- A4 landscape:
778
- Letter portrait:
535
- Letter landscape:
715
- Label (57 x 102 mm):
158
- A4 portrait:
Done. You can now select your custom rendering layout on the Document Layout page.