Set different footer pictures in MS Excel worksheet via SheetRender API in .NET

Hi,


I hope this not a bug, but I am trying to render a worksheet and then send it to print. I have 3 different footers, because I set the first footer and then even and odd footers. The rendering picks up most of the 3 different footer information, however it appears that it doesn’t pick up the different footer pictures and in the end overwrites the first footer picture and even footer pictures with the odd footer pictures. This code works when I save the workbook and then open it in Excel and then print it, but it doesn’t work when I do the SheetRender conversion and then try to print it with Aspose.
Below is my code to illustrate:
  1. code to set up worksheet’s footers
  2. code that renders and prints worksheet

1.

Aspose.Cells.PageSetup pageSetup = ws.PageSetup;

pageSetup.FooterMargin = 2;

pageSetup.IsHFDiffFirst = true;

pageSetup.IsHFDiffOddEven = true;

string patientInfo = “blahblah”

//odd pages (3)

pageSetup.SetFooter(2, “3 " + patientInfo);

//first page (1)

pageSetup.SetFirstPageFooter(2, “1 " + patientInfo);

//even pages (2)

pageSetup.SetEvenFooter(2, “2 " + patientInfo);

//first

pageSetup.SetFirstPageFooter(0, “&G” + " 1”);

pageSetup.SetPicture(true, false, false, 0, barcodeBufferFirst);

//third

pageSetup.SetFooter(0, “&G” + " 3”);

pageSetup.SetPicture(false, false, false, 0, barcodeBufferThird);

//second

pageSetup.SetEvenFooter(0, “&G” + " 2”);

pageSetup.SetPicture(false, true, false, 0, barcodeBufferSecond);

2.)

workbook.Save(stream, Aspose.Cells.SaveFormat.Xlsx);

…

//printing Worksheet

Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();

options.PrintingPage = PrintingPageType.Default;

Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(ws, options);

sr.ToPrinter(form.Printer_Name);

Hi,


Thanks for providing us details.

Could you provide us your saved Workbook ( Excel file) here, we will evaluate your issue soon.

Thank you.

Attached is a 3 page workbook file that I saved through Aspose. Notice in the footers, each barcode is different. This is the correct/wanted behavior, however when I try to print this workbook’s worksheet, using SheetRender, the barcodes are all the same, namely the one I tried to set for only odd pages (minus the first page).


Hope this helps explain the problem.

Hi,


Thanks for the template file.

After an initial test, I observed the issue using your template file while printing the worksheet as you mentioned. I used the following sample code. On each page of the first worksheet, the bar code image should be different (as we can see by taking the print preview of the sheet in MS Excel) but using SheetRender to print the sheet, the barcodes are all the same:
e.g
Sample code:

Workbook workbook = new Workbook(“e:\test2\Aspose+sample.xlsx”);

Worksheet ws = workbook.Worksheets[0];
System.Drawing.Printing.PrinterSettings printSettings = new System.Drawing.Printing.PrinterSettings();
string strPrinterName = printSettings.PrinterName;

//printing Worksheet
Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();
options.PrintingPage = PrintingPageType.Default;
Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(ws, options);
sr.ToPrinter(strPrinterName);

I have logged a ticket with an id “CELLSNET-42463” for your issue. We will look into it soon.

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

Thank you.

Awesome, thanks for the quick reply!

I will be anxiously awaiting the update :slight_smile:

Cheers

Hi,

Thanks for using Aspose.Cells.

Please download and try the fix: Aspose.Cells
for .NET v7.7.2.6
and let us know your feedback.

Good job guys! It appears to be working. I will report back if I have any trouble, but the initial test was positive.


Cheers!

Hi,

Thanks for your feedback and using Aspose.Cells.

It is good to know that your issue is resolved with the latest fix. Let us know if you encounter any other issue, we will be glad to look into it and help you further.

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.