Export data to excel file

To export data to an excel file, we can use the SysExcelWorksheetHelper.
Here an example:

static void exportExcelFile(Args _args)
    SysExcelApplication     xlsApplication;
    SysExcelWorkBooks       xlsWorkBookCollection;
    SysExcelWorkBook        xlsWorkBook;
    SysExcelWorkSheets      xlsWorkSheetCollection;
    SysExcelWorkSheet       xlsWorkSheet;
    SysExcelWorksheetHelper worksheetHelper;
    SysExcelHelper          sysExcelHelper;
    VendRFQJour             vendRFQJour;
    int                     row = 1;
    str                     fileName;
    str                     worksheetName;
    Date                    deliveryDate;

    fileName    = "Path\\Test.xlsx";

    vendRFQJour = VendRFQJour::find("000103");

    worksheetName = "Worksheet name";
    sysExcelHelper = SysExcelHelper::construct();
    xlsWorkSheet = sysExcelHelper.addWorksheet(worksheetName);

    worksheetHelper = SysExcelWorksheetHelper::construct(xlsWorkSheet);

    worksheetHelper.addColumn(1, 'RFQ Id', Types::String);
    worksheetHelper.addColumn(2, 'Delivery date', Types::Date);

    worksheetHelper.setCellValue(1, row, 'RFQId');
    worksheetHelper.setCellValue(2, row, 'DeliveryDate');

    worksheetHelper.setCellValue(1, row, vendRFQJour.RFQId);
    worksheetHelper.setCellValue(2, row, vendRFQJour.DeliveryDate);



    info(strFmt("Creato file: %1", fileName));

Contact persons created with double address

During the import of the contact person, an additional address is always created.
If, in the file, there isn’t an address, the DIEF creates an empty address.

To avoid the problem, we must to insert an additional if clause in the DMFContactPersonEntityClass, method GeneratePostalAddress:

public container GeneratePostalAddress(boolean _stagingToTarget = true)
    container res;

    if (_stagingToTarget && entity.Address) //additional if
        res = DMFLogisticsAddressHelper::GeneratePostalAddressGlobal(entity, target, party, partyRecId,this.getRoleSeparator(), true, _stagingToTarget);

    if (_stagingToTarget)
        res = conNull();

    return res;

Print logo depend on print destination

Goal: print the logo only if the print destination is the printer

First of all we need a parameter, and we declare it in the contract class as follow:

public boolean parmPrintLogo(UsePrintMgmt _printLogo = printLogo)
    printLogo = _printLogo;
    return printLogo;

Then, we must to modify the code of the report controller. The controller must extend the SrsPrintMgmtFormLetterController or a subclass of this.

The method to override is: SrsPrintMgmtController.outputReport()
This method executes the report for the print management setting that is currently loaded.

In this way, for every record in the print management, we control the print destination, and consequently we set the parameter for the logo visibility.

protected void outputReport()
    SalesConfirmContract salesConfirmContract = contract as SalesConfirmContract;

    switch (formLetterReport.getCurrentPrintSetting().parmPrintJobSettings().printMediumType())
        case SRSPrintMediumType::Printer : salesConfirmContract.parmPrintLogo(NoYes::No);

        default : salesConfirmContract.parmPrintLogo(NoYes::Yes);


If the logo visibility, depend on the type of the PrintCopyOriginal, the code to use is the following:

protected void outputReport()
    SalesConfirmContract salesConfirmContract = contract as SalesConfirmContract;
    switch (formLetterReport.getCurrentPrintSetting().parmType())
        case PrintMgmtDocInstanceType::Copy :

        case PrintMgmtDocInstanceType::Original :

Now, we have to use the new parameter in the report layout. We found the parameter here:

Finally, insert the following code in the layout, in the “Visibility” property on the image.

Use HTML in SSRS reports

Create a string that contains HTML code, for example:

(TableName).(MyFieldName) = ‘<span style=”font-weight:bold”>’ + custTable.AccountNum + ‘</span>’;

MyFieldName is the name of the field on the tmp table for the report’s  dataset.

Open the layout in Visual Studio. In the report add a textbox and add to the textbox the MyFieldName field.

Right-Click on the placeholder in the textbox, and then click on “Placeholder properties”.


Select “HTML – Interpreter HTML tags as styles


Item description initialization

The field  “Text”, in the Sales order line details, is initialized depend on some parameters.


The parameters to set for the initialization are the following:

Accounts receivable > Setup > Forms > Form setup > General


  1. Include both name and description = Yes: initialize the field with both the name (product name or search name if product name does not exist) and the description inserted in the EcoResProductTranslation
  2. Include both name and description = No: initialize the field only with the description inserted in the EcoResProductTranslation
  3. External item description = Append: merge the content of the field “Text”, with the External item description of the item
  4. External item description = Overwrite: overwrite the content of the field “Text” with the External item description of the item

You can find product name and description here:


And the external item description here:


SSRS Extra white pages

In the report properties, depend on the “Paper size”, Visual Studio sets automatically the width of the page.

We must consider left and right margins too.


The space that we can use is:

Paper width – left margin – right margin

In our case:

8,27 – 0,7 – 0 = 7,57 in

The body width does not be greater than this size.  To control the body size:

Right click on the body layout  > Properties:


If the body size is greater than the paper size (with margins),  the system adds extra white pages.