I'm attempting to export only certain columns into a datatable. Even if I pass the correct indexs (in an array) it still only returns the the first n columns (n = length of my array) into my datatable. Below is my code. Please help.
int[] columnsToExport = new int[8];
Workbook wb = new Workbook(strTemplateFileName);
Worksheet ws = wb.Worksheets[0];
int trows = ws.Cells.MaxDataRow;
Cell cell = null
cell = ws.Cells.FindString("Employee ID", null);
columnsToExport[0] = cell.Column;
cell = ws.Cells.FindString("Full Name", null);
columnsToExport[1] = cell.Column;
cell = ws.Cells.FindString("Product Line Code", null);
columnsToExport[2] = cell.Column;
cell = ws.Cells.FindString("Sub Product Line Code", null);
columnsToExport[3] = cell.Column;
cell = ws.Cells.FindString("Location ID", null);
columnsToExport[4] = cell.Column;
cell = ws.Cells.FindString("Department Description", null);
columnsToExport[5] = cell.Column;
cell = ws.Cells.FindString("Position Title", null);
columnsToExport[6] = cell.Column;
cell = ws.Cells.FindString("Reports To", null);
columnsToExport[7] = cell.Column;
ws.Cells.ExportDataTable(dt, 0, columnsToExport, trows, true);