We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Multiline headers not supported while rendering to PDF file

Hi

I found subj in the version 7.0.4.0

The reason is simple.
My Excel uses the '\r' symbol for line separate in the headers. I'm not sure is it regional settings, or all Excel versions makes so.
Also I found workaround, I changed the '\r' symbol to the '\n' symbol in all headers and footers.


Call sample
Workbook workBook = new Workbook( "Book1.xlsx" );
FixHeaderFooter( workBook );
workBook.Save( "Book1.pdf", SaveFormat.Pdf );

Fix method

public static void FixHeaderFooter( Workbook workBook )
{
foreach ( Worksheet worksheet in workBook.Worksheets )
{
PageSetup pageSetup = worksheet.PageSetup;
for( int index = 0; index < 3; index++ )
{
string headerFooter;
string fixedHeaderFooter;
headerFooter = pageSetup.GetHeader( index );
if ( !string.IsNullOrEmpty( headerFooter ) )
{
fixedHeaderFooter = FixHeaderFooter( headerFooter );
pageSetup.SetHeader( index, fixedHeaderFooter );
}
headerFooter = pageSetup.GetEvenHeader( index );
if ( !string.IsNullOrEmpty( headerFooter ) )
{
fixedHeaderFooter = FixHeaderFooter( headerFooter );
pageSetup.SetEvenHeader( index, fixedHeaderFooter );
}
headerFooter = pageSetup.GetFirstPageHeader( index );
if ( !string.IsNullOrEmpty( headerFooter ) )
{
fixedHeaderFooter = FixHeaderFooter( headerFooter );
pageSetup.SetFirstPageHeader( index, fixedHeaderFooter );
}
headerFooter = pageSetup.GetFooter( index );
if ( !string.IsNullOrEmpty( headerFooter ) )
{
fixedHeaderFooter = FixHeaderFooter( headerFooter );
pageSetup.SetFooter( index, fixedHeaderFooter );
}
headerFooter = pageSetup.GetEvenFooter( index );
if ( !string.IsNullOrEmpty( headerFooter ) )
{
fixedHeaderFooter = FixHeaderFooter( headerFooter );
pageSetup.SetEvenFooter( index, fixedHeaderFooter );
}
headerFooter = pageSetup.GetFirstPageFooter( index );
if ( !string.IsNullOrEmpty( headerFooter ) )
{
fixedHeaderFooter = FixHeaderFooter( headerFooter );
pageSetup.SetFirstPageFooter( index, fixedHeaderFooter );
}
}
}
}

private static string FixHeaderFooter( string value )
{
string fixedHeaderFooter = value.Replace( '\r', '\n' );
return fixedHeaderFooter;
}

I'm not sure than this workaround is absolutely correct.
I descried that '\n'symbol still present in line as a space, so result is slightly different beside the excel-native result.
But it's simply works.

Regards Alex.
Hi,

Thanks for pointing out the issue.

We found this issue. We think some older versions of MS Excel use '\r\n' where as our product only ignores '\r' and use '\n' character only. Anyways, I have logged a ticket for it with id: CELLSNET-40204. We will provide a fix for it within 2-3 working days.

Thank you.

Hi,


Please try the attached latest fix Aspose.Cells for .NET v7.0.4.1, we have fixed your issue now.

Thank you.

Thank you!

It works perfectly!

Regards, Alex.

The issues you have found earlier (filed as CELLSNET-40204) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.