Posted 12 July 2024, 4:49 am EST
Hi Helmut,
The developers have provided us with the information that this is the intended behavior. Earlier, our border appearance was not compatible with Excel. The merged cell used border of top-left cell to display but not borders of all merged cells like Excel.
If you want to have same appearance in Excel after export, you should consider to using BorderCollapse.Enhanced (flat style must be used) and use new API to set border.
Here is the code snippet for the same:
fpSpread1.LegacyBehaviors = LegacyBehaviors.None; //make sure flat style is used.
fpSpread1.Reset();
fpSpread1.BorderCollapse = BorderCollapse.Enhanced;
IWorksheet activeSheet = fpSpread1.AsWorkbook().ActiveSheet;
fpSpread1.Sheets[0].Cells[3, 4].Value = "Title over three columns";
fpSpread1.Sheets[0].Cells[3, 4].ColumnSpan = 3;
fpSpread1.Sheets[0].Cells[4, 4].Value = "Subtitle 1";
fpSpread1.Sheets[0].Cells[4, 5].Value = "Subtitle 2";
fpSpread1.Sheets[0].Cells[4, 6].Value = "Subtitle 3";
activeSheet.Cells["E4:G4"].Merge();
activeSheet.Cells["E4:G4"].Borders.LineStyle = BorderLineStyle.Medium;
activeSheet.Cells["E5:G5"].Borders.LineStyle = BorderLineStyle.Medium;
fpSpread1.SaveExcel("D:\\temp\\NewTest.xlsx", FarPoint.Excel.ExcelSaveFlags.UseOOXMLFormat | FarPoint.Excel.ExcelSaveFlags.SaveAsViewed);
Kindly refer to the updated sample for full implementation. See
SpannedCellBorder_mod.zip
Thanks & Regards,
Aastha