Open DougHennig opened 9 months ago
Doug—
Can you provide the line number of the places where you are referencing the code that you provided in the original issue report. The code block you reference does not match the code block that I have in Release 39 as shown:
I see where I can apply your suggestion at line 216 above. Please provide your line number ranges.
Greg
From: Doug Hennig @.> Sent: Monday, December 4, 2023 2:15 PM To: ggreen86/XLSX-Workbook-Class @.> Cc: Subscribed @.***> Subject: [ggreen86/XLSX-Workbook-Class] Assuming Header name is Header1 (Issue #102)
There are a few places that assume the Header object of a column is named Header1 but it may not be. Here's the fix:
IF toGrid.HeaderHeight > 0 && Change recommendation by Doug Hennig (if no headers, start in first row)
lnRow = 1
FOR lnCol=1 TO lnColCount
loColumn = toGrid.Columns(laColOrder[lnCol, 2])
*** DH 2023-12-04: don't assume the header object is named Header1
this.SetCellValue(lnWB, lnSh, 1, lnCol, loColumn.Header1.Caption)
loHeader = loColumn.Controls[1]
this.SetCellValue(lnWB, lnSh, 1, lnCol, loHeader.Caption)
*** DH 2023-12-04: end of change
this.SetCellStyle(lnWB, lnSh, 1, lnCol, loGrid.Columns(laColOrder[lnCol, 2]).HeaderStyleId)
this.SetColumnWidth(lnWB, lnSh, lnCol, this.ConvertPixelsToExcelUnits(loColumn.Width))
ENDFOR
*** DH 2023-12-04: don't assume the header object is named Header1
*ADDPROPERTY(loColumn, "HeaderCaption", toGridColumn.Header1.Caption)
*ADDPROPERTY(loColumn, "HeaderFontBold", toGridColumn.Header1.FontBold)
*ADDPROPERTY(loColumn, "HeaderFontItalic", toGridColumn.Header1.FontItalic)
*ADDPROPERTY(loColumn, "HeaderFontName", toGridColumn.Header1.FontName)
*ADDPROPERTY(loColumn, "HeaderFontSize", toGridColumn.Header1.FontSize)
loHeader = toGridColumn.Controls[1]
ADDPROPERTY(loColumn, "HeaderCaption", loHeader.Caption)
ADDPROPERTY(loColumn, "HeaderFontBold", loHeader.FontBold)
ADDPROPERTY(loColumn, "HeaderFontItalic", loHeader.FontItalic)
ADDPROPERTY(loColumn, "HeaderFontName", loHeader.FontName)
ADDPROPERTY(loColumn, "HeaderFontSize", loHeader.FontSize)
*** DH 2023-12-04: end of change
— Reply to this email directly, view it on GitHubhttps://github.com/ggreen86/XLSX-Workbook-Class/issues/102, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGWB33KMBQXVQ4326JEXHVLYHYOKZAVCNFSM6AAAAABAGPOJPOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGAZDINJUGA3DMNQ. You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>
Here's the code for version 39.
IF toGrid.HeaderHeight > 0 && Change recommendation by Doug Hennig (if no headers, start in first row)
lnRow = tnBegRow
FOR lnCol=1 TO lnColCount
loColumn = toGrid.Columns(laColOrder[lnCol, 2])
*** DH 2023-12-04: don't assume the header object is named Header1
* this.SetCellValue(lnWB, lnSh, lnRow, lnCol+tnBegCol-1, loColumn.Header1.Caption)
loHeader = loColumn.Controls[1]
this.SetCellValue(lnWB, lnSh, lnRow, lnCol+tnBegCol-1, loHeader.Caption)
*** DH 2023-12-04: end of change
this.SetCellStyle(lnWB, lnSh, lnRow, lnCol+tnBegCol-1, loGrid.Columns(laColOrder[lnCol, 2]).HeaderStyleId)
this.SetColumnWidth(lnWB, lnSh, lnCol+tnBegCol-1, this.ConvertPixelsToExcelUnits(loColumn.Width))
ENDFOR
*** DH 2023-12-04: don't assume the header object is named Header1
*ADDPROPERTY(loColumn, "HeaderCaption", toGridColumn.Header1.Caption)
*ADDPROPERTY(loColumn, "HeaderFontBold", toGridColumn.Header1.FontBold)
*ADDPROPERTY(loColumn, "HeaderFontItalic", toGridColumn.Header1.FontItalic)
*ADDPROPERTY(loColumn, "HeaderFontName", toGridColumn.Header1.FontName)
*ADDPROPERTY(loColumn, "HeaderFontSize", toGridColumn.Header1.FontSize)
loHeader = toGridColumn.Controls[1]
ADDPROPERTY(loColumn, "HeaderCaption", loHeader.Caption)
ADDPROPERTY(loColumn, "HeaderFontBold", loHeader.FontBold)
ADDPROPERTY(loColumn, "HeaderFontItalic", loHeader.FontItalic)
ADDPROPERTY(loColumn, "HeaderFontName", loHeader.FontName)
ADDPROPERTY(loColumn, "HeaderFontSize", loHeader.FontSize)
*** DH 2023-12-04: end of change
Merry Christmas to you and your family!
I still see this issue in version 44.
There are a few places that assume the Header object of a column is named Header1 but it may not be. Here's the fix: