Place image to the header (only for the first page)

Hi!

Is it possible to place image to the header only for the first page of the sheet?
We use aspose-cells for java v. 7.2.1 and try to run following:

PageSetup pageSetup = sheet.getPageSetup();
pageSetup.setHeader(2, “&G”);
pageSetup.setHeaderPicture(2, picData);

all works fine, but image appears on all pages.
We also tried with little modification:

PageSetup pageSetup = sheet.getPageSetup();
pageSetup.setHFDiffFirst(true);
pageSetup.setHeader(2, “&G”);
pageSetup.setHeaderPicture(2, picData);

The picture on the first page dissapears, but still presents on others. We’ve failed to find out how to leave the picture on the first page and remove on others.
Also tried to use setFirstPageHeader, but still no effect.
There’s no method something like “setFirstPageHeaderPicture” :frowning:
Could you please suggest any approach?
Excel itself allows to achieve desired view.

thanks in advance

Hi,


I tested your scenario/case and tried to achieve your requirements in MS Excel manually but in vain. I am not sure if this is possible in MS Excel either. Could you please create a sample Excel file manually in MS Excel that should have header picture only in the first page and not on the other pages of the sheet. You may save the Excel file and provide us here, we will check your issue soon. For your information, Aspose.Cells follows MS Excel standards, so if a feature is supported in MS Excel, Aspose.Cells can support it as well, if MS Excel does not support it, Aspose.Cells cannot support it.




Thank you.

Amjad, thank you for reply.

I created attached file manualy in MS Excel 2010 (russian edition). You can see image at the right corner of the footer on the first page and no images on other pages. That’s what i really needed.

Hope to hear from you

Hi Serg,

Thank you for sharing your template file.

As my colleague has mentioned, we are unable to manually create a similar file as of yours using MS Excel 2010. Could you please share, what steps did you follow to achieve this? These details would be of great help in analyzing this feature request, and to bring it up on our road map of Aspose.Cells component.

Looking forward to your response.

Hi, Babar.

It’s much simpler to show than explain(see attached video).
Quality is not good enough but I hope you’ll get the point.
If afterwards it will not be clear enough I’ll try to explain it with step-by-step instruction.

thanks for your attention

Here is step-by-step instruction form Microsoft to create such kind of file manualy:

http://office.microsoft.com/en-001/excel-help/print-a-header-only-on-the-first-page-HA102809338.aspx
and I’m so sorry for mistake in the text above and attached filenames - sure I meant “Header” not footer.

Hi Serg,

Thank you for providing enough information to properly analyze this requirement on our end. I have logged a ticket in this regard and requested the development team to check the feasibility of the required feature. Ticket Id for your future reference is CELLSJAVA-40628.

We will get back to you as soon as we have any updates.

Hi Babar,

thank you very much for your quick response and hope that your team will find this feature not so hard to implement.

best wishes

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


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

Hi Serg,

Thank you for your patience.

In order to fulfill your requirement we have added a new method PageSetup.setPicture in our latest version of Aspose.Cells for Java v7.6.0 (download link shared above). Method signature and its usage is provided below,

PageSetup.setPicture(boolean isFirst, boolean isEven, boolean isHeader, int section, byte[] imageData)

Code Sample:
pageSetup.setHFDiffFirst(true);
pageSetup.setFirstPageHeader(2, “&G”);
pageSetup.setPicture(true, false, true, 2, image);

Please give a try at your end and feed us back with your results.

Hi Babar,

It works!
Thank you very much and best wishes