Hi,
i am having a problem regarding exporting an ultra grid to excel file.
for exporting a single data grid i am using the following code.it is working properly.
ResourceSetupUGExcelExporter.FileLimitBehaviour = ExcelExport.FileLimitBehaviour.TruncateData
ResourceSetupUGExcelExporter.Export(gridNeedToPrint, reportName)
my problem is that i am having two ultra win grid's and i want to export them to a single excel in horizontal .
could you please provide a good solution for my problem.
one more problem is that one of the column consist of check box and while exporting the check box it is displayed as true/false in excel sheet.
is there any way to copy the check box as it is so that it could be displayed neatly in excel file instead of true/false.
Thanking You.
syago01 said: my problem is that i am having two ultra win grid's and i want to export them to a single excel in horizontal . could you please provide a good solution for my problem.
What's the problem? Are you trying to export both grids to the same worksheet? Or to two different worksheets?
syago01 said: one more problem is that one of the column consist of check box and while exporting the check box it is displayed as true/false in excel sheet. is there any way to copy the check box as it is so that it could be displayed neatly in excel file instead of true/false.
There is currently no built-in way to do this.
Hi Mike,
i am trying to export both grid's to a single worksheet.
is it possible????
this is my first problem.
My second problem is that i want to export checkbox data grid as it is to the worksheet.
syago01 said: i am trying to export both grid's to a single worksheet. is it possible????
Yes, I think so. There are overloads of the UltraGridExcelExporter.Export method that take a worksheet as well as a starting Column and Row index. So you can create a workbook and add a Workshet to it. then export he first grid to the worksheet. Then export the second grid to the same worksheet and specify the starting coordinates under the first grid. To determine the coords, you will handle the EndExport event and use the CurrentRowIndex and CurrentColumnIndex after the first grid is exported.
Hi Mike sorry for the late reply can u please tell me elaborately
with code as how
to create workbook and adding a work sheet.
then export the first grid and exporting second grid
Thanks,
It's really pretty simple. The only trick is storing the index that the first grid ended at.
private void button1_Click(object sender, EventArgs e) { // Create a new workbook Workbook workBook = new Workbook(WorkbookFormat.Excel2007); // Add a worksheet. Worksheet worksheet = workBook.Worksheets.Add("My WorkSheet"); // Export the first grid. this.ultraGridExcelExporter1.Export(this.ultraGrid1, worksheet); // Export the second grid under the first. this.ultraGridExcelExporter1.Export(this.ultraGrid2, worksheet, this.lastCurrentRowIndex + 1, 0); // Save the Workbook string fileName = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "x.xlsx"); workBook.Save(fileName); // Launch it in Excel so we can see the results. Process.Start(fileName); } int lastCurrentRowIndex; private void ultraGridExcelExporter1_EndExport(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.EndExportEventArgs e) { // Store the last CurrentRowIndex when the export completes. this.lastCurrentRowIndex = e.CurrentRowIndex; }