is there any way to export the data from infragistics ultraweb grid to a specific excel file which is havinng some formats?
say i have my template in \Templates folder in my server. (i.e \Templates\UserTemplate.xls) i want to write my data from the webgrid to this excel. our server may not have excel installed so i am using infragistics.excel.
thanks
arun.k.s
atmy@chevron.com
You can try loading your own .XLS workbook into an Infragistics.Excel Workbook object using its Load method. If there is anything the Workbook object doesn't recognize, it will try to preserve it as-is for when you Save the workbook back to a file or for transmission to the end user.
You can also direct WebGridExcelExporter to begin exporting at a specific position on a Worksheet by setting its ExcelStartRow and ExcelStartColumn properties. Left to its own designs, at this point WebGridExcelExporter will start writing out your WebGrid in rectangular fashion with the specified cell as the top, left corner of a rectangular region. If there is any formatting underneath where the exporter is writing, it will probably be overwritten. If even further fine grained control is necessary, there are a number of events you can handle (for example, to put the first 100 rows on Sheet1, the second 100 rows on Sheet2, etc.)
So this should work relatively easily if your template has a nice rectangular region in it for where you want the WebGrid to be exported, and all the customizations are around the margins or before the start of the exported WebGrid at the top of the Worksheet. As your template worksheet grows more complex, the more likely you're going to need to direct the export so it retains your areas of custom formatting.
One thing WebGridExcelExporter will do is resize the Worksheet columns where it exports cell values because it tries to guarantee the column is at least as wide as the widest cell value. If you have a column formatted to a specific width in your template for some reason, then this behavior may actually lead that column width to become narrowed. You can stretch the columns back to your desired width (measured in twips) in the EndExport event.https://es.infragistics.com/help/aspnet/web-webexcelexporter
Hi,
I wanted to know how to convert the length of a column in ultrawebgrid which is in pixels to that in excel(integer).
For example if the size of column1 is 150px then in excel the size could be 2500 (which is an integer)
Dim owb As Workbook = New Infragistics.Excel.Workbook()Dim len1 As Unitlen1 = UltraWebGrid1.Columns(0).Widthowb.Worksheets.Item(0).Columns(0).Width = len ' this gives me an error
owb.Worksheets.Item(0).Columns(0).Width = len.value ' this works fine. But the width of column on excel is very small and is not visible.
If I multiply len.value by a number then things works but I want the actual convertion factor which should be used.
Thanks,
Junaid.
Hi Derek,
I also tried to load an excel file and then I tried to put some data into my template but it does not work.
Can you give me a hint what I'm doeing wrong?
Thank you,
Jos
Code:
Dim ExcelFile As Infragistics.Excel.Workbook ExcelFile = New Infragistics.Excel.Workbook() ExcelFile = Infragistics.Excel.Workbook.Load("c:\vorlage.xls")' add new does work but the load does nothing ExcelFile.Worksheets(0).Rows(0).Cells(0).Value = "TEST" ExcelFile.Save("c:\test.xls")
I need to do this to, but being fairly new to vb.net, I am not clear on how to use the load method. When calling the function, i am not clear on how to return the opened file. do you have any examples using the load method?
Me.UltraGridExcelExporterRepFiles.Export(Me.grdJobHdr, LoadTemplate(sFileName), 4, 1)
Public Overloads Shared Function LoadTemplate(ByVal fileName As String) As Infragistics.Excel.WorkbookEnd Function
end code
I am not sure what belongs in the function to get it to return the xls file i am using.probably due to my lack of knowledge/experience.
Any help would be appreciated.
Markpisc