What is the use of ExportAsString & FormatStrategy in ExportTableOptions

what is the use of ExportAsString & FormatStrategy in ExportTableOptions?

@emeghana,

  1. The Boolean ExportAsString option in ExportTableOptions will make sure to export cells data as string/text (type) value to the DataTable.

  2. The attribute FormatStrategy in ExportTableOptions lets you apply format strategy as per the CellValueFormatStrategy enum when exporting values as string/text (using the above option).

Hope, this helps a bit.

where can i exactly know about Formatstrategy ?

@emeghana,

The property FormatStrategy in ExportTableOptions lets you apply format strategy as documented in CellValueFormatStrategy reference page for the enumeration, please see each enum member with complete description on the page.

Also, see the sample code segment for your reference.
e.g.
Sample code:

Workbook workbook = new Workbook("Book1.xlsx");
var workSheetCells = workbook.Worksheets[0].Cells;
//Create style object, number 49 means Text format
Style st = workbook.CreateStyle();
st.Number = 49;
workSheetCells.Columns[0].ApplyStyle(st, new StyleFlag() {NumberFormat = true});
var exportTableOptionsNone = new ExportTableOptions
{
    ExportAsString = true,
    ExportColumnName = false,
    FormatStrategy = CellValueFormatStrategy.CellStyle,
    CheckMixedValueType = true
};

DataTable dtNone = workSheetCells.ExportDataTable(0, 0, 6, 1, exportTableOptionsNone);
......
1 Like