I am Working on a report,where i have an ultragrid & ultrachart.I want to export these two together in excel.Currently i am able to export my ulragrid and ultra chart but both of are getting exported in two different excel files. I have searched a lot but couldn't get any proper answer.Can anyone plz help me out
Case "Export"
btnExport_Click()
objGrid.fn_UGrid_ExportFullGridPopup(ugridAuction, True, True, False, Me.Text)
Private Sub btnExport_Click()
Dim w As New Infragistics.Excel.Workbook()
Dim s As Infragistics.Excel.Worksheet = w.Worksheets.Add("Chart")
Dim ms As New System.IO.MemoryStream()
Me.UltraChartAuction.SaveTo(ms, Infragistics.UltraChart.Shared.Styles.RenderingType.Image)
Dim i As New Infragistics.Excel.WorksheetImage(Image.FromStream(ms))
i.TopLeftCornerCell = s.Rows(0).Cells(0)
i.TopLeftCornerPosition = New PointF(0.0F, 0.0F)
i.BottomRightCornerCell = s.Rows(20).Cells(6)
i.BottomRightCornerPosition = New PointF(0.0F, 0.0F)
s.Shapes.Add(i)
Dim theFile As String = Application.StartupPath + "\" & DateTime.Now.Ticks.ToString() & ".xls"
w.Save(theFile)
ms.Dispose()
Process.Start(theFile)
End Sub
Hello ,
I have created a small sample in order to demonstrate how you could export UltraGrid and UltraChart in same workbook. Please run the sample and let me know if this is what you are looking for.
Please let me know if you have any further questions.
We are using infragistics v10.3
so i am getting error for the below line
Infragistics.Win.UltraWinGrid.ExcelExport.
UltraGridExcelExporter.Export(ugridAuction, book)
after UltraGridExcelExporter i am getting only 3 option
UltraGridExcelExporter.Equals
UltraGridExcelExporter.ExcelRelevantPropFlags
UltraGridExcelExporter.ReferenceEquals
Also i am not getting SaveTo for the below line
ugridAuction.SaveTo(ms, Infragistics.UltraChart.Shared.Styles.
.Image)
Hello,
I have modified my sample to works with Infragistics 10.3.
You are getting only 3 option after UltraGridExcelExporter , because the UltraGridExcelExporter is a Type and it doesn’t expose any static method for Export. You should create an instance of UltraGridExcelExporter and then you will be able to call Export method of this instance. You should use code like:
Dim ugExcelExporter As New UltraGridExcelExporter()
ugExcelExporter.Export(UltraGrid1, book)
I am not sure what is the type of ugridAuction, but I assume that this is UltraGrid , because you are passing it as a parameter of the Export method of UltraGridExcelExporter. So UltraGrid doesn’t expose a method SaveTo(…), UltraChart has exposed SaveTo(…) method. So I asume that you want to get an image of UltraChart, which will be put into the exported Excel, so you should call SaveTo(...) method of the UltraChart, which you want to export.
Now i am getting my result but i wanted grid and chart to be shown in the same sheet and not two different sheets
In order to export UltaGrid and UltraChart in the same Worksheet you should pass as second parameter of the Export(…) method Worksheet object, which will be used to export UltraGrid, then to add WorksheetImage to the same Worksheet object. I have modify the sample in order to demonstrate this approach.
I hope this helps you.
Thanks ,this exactly what i wanted...
Thank you for your feedback and for sharing this with us. We believe that the other community members could benefit from such threads.
Please feel free to let me know if a question about our toolset comes up on your mind.
By MauryaIsha in WinGrid
Can you please let me know how to place ultrachart and ultragrid one below the other while exporting to pdf.
I want the chart to be placed first and then the grid.
Thanks in advance.