Hello!
I am trying to export the content in my UltraWinGrid but I have some problem with the cell borders.
At first, all of the excel cells that as exported from the grid ended up without borders. I then found a property
called WorkSheetCellFormat of the excel cell. So in the CellExported event of the UltraGridExcelExporter, i changed the formatting to exclude BorderFormatting.
That helped a lot but I still have some rows left that doesn't have borders.
Does anyone now how to fix these?
Private Sub ugExcelExport_CellExported(sender As Object, e As Infragistics.Win.UltraWinGrid.ExcelExport.CellExportedEventArgs)
Try
e.CurrentWorksheet.Rows(e.CurrentRowIndex).Cells(e.CurrentColumnIndex).CellFormat.FormatOptions =
WorksheetCellFormatOptions.ApplyAlignmentFormatting + WorksheetCellFormatOptions.ApplyFontFormatting + WorksheetCellFormatOptions.ApplyNumberFormatting
Catch ex As Exception
End Try
End Sub
Hi Zlatan,
By default, the cells will export with borders. It appears that this issue is occurring on specific cells in your worksheet. It looks like the second row after an item is expanded is affected. I will need to take a closer look at your code in order to solve this. Is it possible for you to send a reproduction sample that I can look into? If not, are you able to send your exporting code?
Please let me know if you can provide this information.
Are you able to provide a reproduction sample? Please let me know.
Sorry for my late reply Mike!
Here comes an example code, not exactly according to my case but it shows the same problem.
Some cells in the export doesn't get borders.
I hope you can help me out here...
Thanks!
/Henrik
Hi Henrik,
I downloaded and ran your sample, and I can see that the borders are not there. I will look into this more and let you know what I find.
I believe I have figured out how you can solve this. The reason that some of the cells in the exported worksheet are exporting without borders are because these cells have no borders on the grid. For the data cells, you have handled this in the CellExported event by excluding the ApplyBorderFormatting option from the FormatOptions property of those cells. However, this event does not handle the HeaderCells. In order to get borders to appear for these cells in the exported document, you can handle the HeaderCellExported event and write code similar to the code in your CellExported handler.
Please try this out and let me know if it solves the issue.
Yes, it works like you mentioned. It was good that you highlighted that fact to me, since I could change the font color of the header texts in the same procedure. Have completely missed thas those weren't visible ;-)