I followed the answer in this posts, which is similar to what I want to achieve:
http://forums.infragistics.com/forums/t/38674.aspx
When I open the excel file the data has been correctly written, but row height and column width of the exported area has been set to 0 so it appear as hidden.
I have a DataTable with the content I want to export, then I make a XamDataPresenter and set the source to be the DataTable:
var dataPresenter = new XamDataPresenter();dataPresenter.BeginInit();dataPresenter.DataSource = dataTable.DefaultView;dataPresenter.EndInit();return dataPresenter;
var dataPresenter = new XamDataPresenter();
Then I make a new workbook and export the dataPresenter to the file:
var workbook = new Workbook(WorkbookFormat.Excel97To2003);var worksheet = workbook.Worksheets.Add(destinationSheet);_excelExporter.Export(dataPresenter, worksheet);
But as I said, the heigth and width of the rows and columns in the Excel sheet is 0 so it appear as hidden.
I've managed to do a workaround, by setting the size of rows and columns in the sheet manually after the export:
for (var colum = 0; colum < dataTable.Columns.Count; colum++) worksheet.Columns[colum].Width = 4257;
for (var row = 0; row < dataTable.Rows.Count+1; row++) worksheet.Rows[row].Height = 345;
for (var row = 0; row < dataTable.Rows.Count+1; row++)
But this is time-consuming so is it a other way to set this through fieldlayouts or similar?
I have also tried setting the default height and width in the worksheet and as fieldsettings on the dataPresenter before exporting with no effect:
worksheet.DefaultRowHeight = 345;worksheet.DefaultColumnWidth = 4257;
dataPresenter.FieldSettings.CellWidth = 1632;dataPresenter.FieldSettings.CellHeight = 1632;
Any tips and help would be most appreciated.
Hello,
I did not hear from you so just checking if you were able to resolve your issue. Please let me know if there is anything I can help with on this issue.
I created a sample project based on your description and I could not reproduce the issue. I do not see any row height and column width to 0.
Can you please modify my sample to show the issue and send me the steps to reproduce it.