Icon

Session4 Part3

There has been no title set for this workflow's metadata.

There has been no description set for this workflow's metadata.

Annotations and comments
  • L2-DA Demo Workflow for Sessions 4 - Part III Styling Excel Sheets
  • Learning objectives: Style and organize Excel sheets with KNIME nodes Workflow description: An Excel sheet is formatted with Continental Nodes for KNIME. A control table is generated based on an existing Excel sheet. Then different parts of the sheet are formatted according to the tags found in the control table. In particular, we change background colors, borders, cell formats, and column widths. Formatting information is passed on through the XLS format connections, with new formatting information added to the existing formatting information.
  • Reading an Excel sheet A sheet with store report is read from an Excel file by an Excel Reader node. The sheet Onsite Store is selected. The path for the Excel file is passed on as a flow variable excel-file specified under the Flow Variables tab.
  • Creating a control table A control table in the shape of the Excel sheet is generated by the XLS Control Table Generator node. Check the option write column header to first row. The resulting table has the same shape as the Excel sheet of interest The first Rule Engine node is used to generate tags for Column A. If ROWID is 1, then the tag header is output to replace Column A. Otherwise the tag row_header is output to Column A. The second Rule Engine node is used to generate tags for Column B. If ROWID is 1, then the tag header is output to replace Column B. Otherwise the tag financial is output to Column B. The third Rule Engine node is used to generate tags for Column C. If ROWID is 1, then the tag header is output to replace Column C. Otherwise the tag number is output to Column C.
  • Selecting a sheet A sheet to be formatted is selected by the XLS Sheet Selector node
  • Setting background colors Each XLS Background Colorizer node has two input ports. The top input port receives the control table, whereas the bottom input port receives the XLS format connection from the previous formatting node. The new formatting information is added to the existing XLS formatting information. The first XLS Background Colorizer node sets the color to the header cells, by specifying the tag header. The second XLS Background Colorizer node sets the color to the row header cells, by specifying the tag row_header.
  • Setting borders The XLS Border Formatter node adds a border at the bottom of the header cells, by specifying the bottom border with the tag header.
  • Setting cell formats The XLS Cell Formatter node specifies the format of the cells tagged as financial. These cells contains the total sale amount, thus the financial format with two decimal places is specified.
  • Setting column widths The XLS Row and Column Sizer node adjusts the column widths. The column widths are automatically adjusted by the widths of the contents of the cells tagged as header.
  • Applying formatting information The XLS Formatter (apply) node applies all the formatting information from all the XLS formatter nodes. The location of the Excel file is passed on by the flow variable excel-file created by the Excel Reader node. The newly formatted Excel file is saved as StoreReport_formatted.xlsx under the data folder, so that the original Excel file is not overwritten.
  • Reading an Excel file on store report, for onsite stores
  • Tags for Column B
  • Tags for Column A
  • Tags for Column C
  • Setting background color for header
  • Setting background color for row header
  • Border bottom of the header row
  • Setting the format for total sale amounts as financial format
  • Creating a control table
  • Applying all the formats, saving to a separate Excel file
  • Adjusting column widths automatically
  • Selecting sheet Onsite Store

Nodes

Extensions

Links