Free Support Forum - aspose.com

Overline error

The attached document is transferred to the system, a line is formed at the top of the document
I attached the original file and corrupted file. We are using Aspose.Cells 20.6 version. Thanks.
YG12407.zip (412.0 KB)

@srmbimser,

Thanks for the template file.

Please notice, I am able to reproduce the user mentioned by converting your template file to PDF file format. I found a line is inserted at the top of the document for some reason in Excel to PDF conversion. I have logged a ticket with an id “CELLSNET-47464” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

@srmbimser,
We can see the underline style ("&U") defined in the right header for several space chars. In Microsoft Excel, sometimes the underline appears, sometimes the underline disappears. e.g. If we remove “\n”, the underline will appear.

Code:

Workbook wb = new Workbook("orginaldocument.xls");

Worksheet sheet = wb.Worksheets["Sayfa1"];
string rightHeader = sheet.PageSetup.GetHeader(2);
Console.WriteLine("Origin header: " + rightHeader);
rightHeader = rightHeader.Replace("  \n  ", "");
Console.WriteLine("Modified header: " + rightHeader);
sheet.PageSetup.SetHeader(2, rightHeader);

wb.Save("output.xlsx");

wb.Save("output.pdf");

We can’t fix it for the inconsistent behavior.

We tested this block of code. However, we observed that the problem was not solved. No error on MS Excel side

@srmbimser,
We have noted your comments and will share our feedback after further investigation.

@srmbimser,
The code in the last comment just wants to prove that Microsoft Excel will also show/render the line in some case. In the output file “output.xlsx” generated by the above code, the line appears in the Microsoft Excel Printview.(see attachment “printview_with_line.png”).
printview_with_line.png (51.0 KB)

A workaround to remove the line is removing the spaces at the end of Header/Footer.

Code:

Workbook wb = new Workbook("orginaldocument.xls");

Worksheet sheet = wb.Worksheets["Sayfa1"];
string rightHeader = sheet.PageSetup.GetHeader(2);
Console.WriteLine("Origin header: " + rightHeader);
//remove spaces at the end of Header
rightHeader = rightHeader.TrimEnd();
Console.WriteLine("Modified header: " + rightHeader);
sheet.PageSetup.SetHeader(2, rightHeader);

wb.Save("output.xlsx");

wb.Save("output.pdf");

We are waiting for your suggestions for a permanent solution on this subject.

@srmbimser,
Once, we will have some news for you, we will update you in this topic.

@srmbimser,

We are working over your issue and we will try to provide the fix the issue before the end of this week or at the start of next week.

Keep in touch.

@srmbimser,
Please try our latest version/fix: Aspose.Cells for .NET v20.7.5:
Aspose.Cells20.7.5 For .Net2_AuthenticodeSigned.Zip (5.4 MB)
Aspose.Cells20.7.5 For .Net4.0.Zip (5.4 MB)

Your issue should be fixed in it.

Let us know your feedback.