10 - 12 - 2024

Microsoft

Block DataSetExportToExcel

License: Industrial

Because the DataSet represents a database in the memory, it can easily be exported to an Excel document. For this purpose, the DataSetExportToExel block is used. When the input DoExport becomes to high level, the data located at the input InDataSet will be saved to excel document with name specified in the FullFileName parameter. At the DataSet parameter you need to set which columns from the incoming InDataSet will be exported and in what sequence.

Block's parameters:

  • DataSet - description of the exported columns from the input InDataSet and their sequence;
  • AutoOpenExcel - if the parameter is checked, when the document is saved, the Excel application will be open;
  • FullFileName - path and name of the exported excel file, for example: c:\AltonaLab\Doc\Test.xls
  • Disable - in case the parameter is checked, the block will not work;

Block's inputs:

  • InDataSet - the contents of this DataSet will be exported to the excel document;
  • DoExport - when the input becomes to high value, the input InDataSet will be saved as document;
  • InFullFileName - if the input is connected, the full file name of the document will be gotten from this input instead of the parameter FullFileName;

Block's outputs:

  • OnReady - becomes at high level then the document is saved;
  • ExportResult - describes the possible causes for a file write error;

Important!!! Before use of this block, library.dll has to be installed! In other case, the application will crash, when the block tries to export the DataSet to excel document. For this purpose, please do the next:

  • Find Command prompt, click over its icon with right mouse button and run it as Administrator;
  • go to c:\AltonaLab, this can happend with the next command prompt commands:
    c:
    cd c:\AltonaLab
  • register library.dll - type a command prompt command: Regsvr32 library.dll

 

Block ExcelReader

License: Industrial

The block gives us an easy way to load the contents of an Excel document in DataSet. In the DataSet parameter, we need to describe the columns of the document, data type and their sequence. When the parameter DataSet is opened, column of the grid: ExcelColumn is very important, it specifies the DataSet column, from which excel column of the document will be read. The output of the block OutDataSet will be with the same columns as the parameter DataSet.

Block's parameters:

  • DataSet - describes the output of the block OutDataSet and sequence of the reading of the excel document;
  • FullExcelFielName - the file path and name of the reading excel document;
  • StartingRow - the first row of the document from which the reading starts. If the document has a header, it is logical to start reading from the second line;
  • Disable - in case the parameter is checked, the block will not work;

Block's inputs:

  • Load - when the input becomes to high level, the block will read the excel document and will refresh the output OutDataSet with read information;

Block's outputs:

  • OutDataSet - contains the read data from excel document;
  • OnReady - becomes to high level, when the document is read;
  • NumResords - the number of records in output OutDataSet;
  • ReadResult - describes the possible causes for a file read error;

 

Block ExportToWord

License: Industrial

The block is extremely powerful and allows easy creation of complex reports, including block output values, DataSets content, images from the executed diagram. For this purpose we first create a WORD document, which we will call the Template.

In the Template, we can deploy three types of objects whose values we take from a working diagram:

  • Tags - With the parameter WordDocTags we can add an unlimited number of inputs to the block of different data type. If we put the name of one of these inputs in brackets <> in the WORD tempate document, during the export, the TAG will be replaced with the value of the input;
  • Images - it is extremely simple to add an images of some controls on the diagram in the exported WORD document. For this purpose, simply in brackets <> we have add the name of the control in the WORD template. During the export, the TAG will be replaced with the image of the control as a JPG;
  • Tables - we can export up to 3 DataSet in WORD documents as tables. To do this, we simply need to connect one or more of the inputs of the block: InTable1, InTable2, InTable3, and specify for each input the corresponding parameters Table1, Table2, Table3 - which of the input DataSet columns will be exported. The names and types of columns in parameters: Table1, Table2, Table3 should be the same as those that are in the connected inputs: InTable1, InTable2, InTable3. In Table1, Table2, Table3, we can only describe those columns from input DataSet that we will export, there is no need to describe all the columns contained in the input DataSet. At the WORD Template is necessary to add as many tables as the inputs of the block are connected: InTable1, InTable2, InTable3, and in each table of the template to add as many columns as there are columns specified in the corresponding parameters Table1, Table2, Table3. That is all.

Block's parameters:

  • WordDocTags - describes the TAGs used in WORD tempate. Every TAG will appear as block's input. If the name of the TAG is used in brackets <> at text in WORD tempate, the TAG will be replaces with a value of the corresponding input;
  • Table1, Table2, Table3 - describes the columns at DataSet inputs InTable1, InTable2, InTable3. The DataSets from the connected inputs will be exported as tables at WORD document;
  • FullPattenFileName - file path and name of the template WORD document, where the TAGs, Images and Tables are described;
  • FullResultFileName - file path and name of the exported WORD document, has to be different from FullPattenFileName;
  • AutoOpenWord - when the parameter is checked, after the export to WORD, the WORD application will be open. In other case, just the result FullResultFileName file will be saved, without openening of the WORD application;
  • Disable - when the parameter is checked, the block will not work;

Block's Inputs:

  • DoExport - when the input becomes to high value, the block will export the WORD document;
  • InFullResultFileName - if the input is connected, the path and name of the saved WORD document will be gotten from this input instead of parameter FullResultFileName;
  • InTable1, InTable2, InTable3 - if some of this inputs are connected, the DataSets from the inputs will be exported as table at WORD document;

Block's Outputs:

  • OnReady - becomes to high level, when the document is exported;
  • ExportResult - describes the possible causes for a export error;

Example:
For example, please load the diagram from DEMOs - MicrosoftExports.nsm. The WORD template file is: c:\AltonaLab\Demos\TestPatt.docx

The demo diagram is:

The demo WORD template:

Before run the diagram, please install library.dll, it is needed for export to Excell block. The diagram has two sine wave generators and theirs signals are substracted. All the result signals are stored at DataSetStorageBlock and is shown at Image control.

When the button Export to excel is pressed, the export will look like:


When the button Export to word is pressed, the export will look like: