DataGrid Data Export

Home / Support / Manuals / Administrator Guide /

DataGrid Data Export

1. General information

DataGrid data export allows users to download the data displayed in a view table to a file in a selected format. Export is available via an icon in the DataGrid header and can be disabled in the DataGrid control settings (see View Page - DataGrid).

Export is available only in the following cases:

  • A valid database query (data source) is configured for the DataGrid.
  • Or the view is a historical record view.

2. Export formats

The following formats are offered to the user in the export dialog:

2.1. XLSX (MS Excel)

  • The default format when the export dialog is opened.
  • Generates an Office Open XML file (.xlsx).
  • Supports the footer option with column totals.
  • After a successful export, the external function "NETGenium.DataGrid2Excel" is triggered with parameters: file path, query identifier, form ID, date from, date to.
  • If the number of columns or rows exceeds the limits defined in the configuration files “MaxExcelColumns.txt” and “MaxExcelRows.txt” located in the “Config” directory, the export automatically switches to CSV format.

2.2. XLS (MS Excel 97-2003)

  • Generates a BIFF8 format file (.xls).
  • Supports the footer option with column totals.
  • Subject to the same automatic switch to CSV as XLSX when limits are exceeded.

2.3. CSV

  • Values are separated by a semicolon (;).
  • File encoding is UTF-8.
  • The file header contains column names.
  • Text values are enclosed in quotation marks per the CSV standard.
  • CSV is also the target format when automatically switching from XLSX or XLS.

2.4. DOCX (MS Word)

  • Generates an Office Open XML file (.docx).
  • Data is inserted as a table.

2.5. DOC (MS Word 97-2003)

  • Generates a DOC format file (.doc).
  • Data is inserted as a table.

2.6. HTML

  • Generates an HTML file containing the DataGrid data as an HTML table.
  • Values are converted before writing according to the export option settings (foreign keys, attachments, tags).

2.7. TXT

  • Generates a text file with the DataGrid data.
  • Values are converted before writing according to the export option settings.
  • File encoding is UTF-8.

2.8. SQL

  • Generates a text file with SQL statements.
  • If the database query does not use joins (JOIN), INSERT statements are generated for each data row.
  • For each column with a non-empty database name, a listing in the format "column = (value1, value2, …)" is generated — one line per column, values separated by commas.
  • Supported value data types: String (quoted), Integer, Long (integers), Double (decimal numbers), Date (database format).
  • NULL value is written as the literal "NULL".
  • File encoding is UTF-8.

2.9. C#

  • Generates a text file with C# code representing data as a List<object[]> collection.
  • Each data row is converted to array.Add(new object[] { … });.
  • Supported value data types: String (escaped quotes), Integer, Long, Double, DateTime.
  • NULL value is written as DBNull.Value.
  • The resulting file is saved with a .txt extension.
  • File encoding is UTF-8.

2.10. Attachments (ZIP)

  • Exports physical attachment files from all columns of type File (Attachment).
  • Files are packed into a ZIP archive.
  • Each file name in the archive follows the format: ID-{record id}-{column name}-{file name}.
  • Diacritics are automatically removed from file names in the archive.
  • If no column contains attachments or all attachment files are missing on disk, the export fails with an error.

2.11. XML

  • Generates an XML file with schema (XmlWriteMode.WriteSchema).
  • For RichTextBox columns, images are exported by default (converted via Attachment.ExportImages).
  • For File (Attachment) columns, an auxiliary column "{column name} (Path + FileName)" is added to the dataset, containing the file path and file name separated by a tab character.
  • Column names in the XML are adjusted to be unique.

2.12. XML + Base64 attachments (XML2)

  • Available only for users with administrator rights.
  • Works the same as the XML format, but for File (Attachment) columns adds an auxiliary column "{column name} (Path + FileName + Base64)" containing the file path, file name, and Base64-encoded file contents, all separated by tab characters.
  • If an attachment file cannot be read, the Base64 part is omitted and the column contains only the path and name.
  • The resulting file is saved with an .xml extension.

3. Export options

The following options are available in the export dialog:

3.1. All columns

  • If checked, all columns of the database table are exported, not just the columns currently displayed in the DataGrid.
  • For historical views, this option is always automatically enabled and cannot be changed.
  • If the DataGrid has customization disabled (DenyCustomization), this option is automatically turned off regardless of user input.

3.2. Disable ngef

  • If checked, column values are not transformed via ngef functions during export.

3.3. Remove HTML tags

  • If checked, HTML tags are removed from values before writing to the output file.
  • Applies to formats: XLSX, XLS, CSV, HTML, TXT.

3.4. Foreign keys as integers

  • If checked, values in ForeignKey columns are exported as numeric identifiers instead of display text.

3.5. Attachments as integers

  • If checked, values in File (Attachment) columns are exported as numeric identifiers instead of file names.

3.6. Show footer

  • Available for XLSX and XLS formats.
  • If checked, a footer row with aggregated values (totals, etc.) is added to the exported file for each column where the footer is not hidden.

4. Automatic format switching

  • If the XLSX or XLS format is selected and at least one of the following conditions is met:
    • The number of exported columns exceeds the limit defined in the “MaxExcelColumns.txt” configuration file in the “Config” directory.
    • The number of exported rows exceeds the limit defined in the “MaxExcelRows.txt” configuration file in the “Config” directory.
  • The export automatically switches to CSV format.
  • Switching occurs before the file is generated.

5. Export logging

  • Every completed export is automatically recorded in the application log.
  • Two log entries are written: one after the database query is executed (with row count and query text), and one after the file is generated (with row count and file name).
  • The following information is recorded: user name, operation duration, number of affected rows, query text or generated file name.

6. Security

  • Access to the export is secured by an encrypted parameter in the URL.
  • Login verification and Session Fixation protection are performed on every request.
  • Export can be disabled at the DataGrid level by checking the "Disable data export" option in the DataGrid control settings.
  • The XML2 format (with Base64 attachment contents) is available exclusively to users with administrator rights.