header and footer issues

Technical support for Spire.XLS

Moderators: iceblue support, Flash, Manager

header and footer issues

Postby jslots » Thu Aug 30, 2012 8:16 am

Dear Iceblue,

I have some issues with images in headers and footers.
1) When i add an image to the header section, the image is not displayed when i open the generated document:
I add the image like this:

Code: Select all
sheet.PageSetup.RightHeaderImage = ImageFactory.GetCompanyLogoSmall();

Can you reproduce this?
For you info: i am using the Spire.Office - pack, version 2.3.5.

2) When i add a rightFooter, the footer is not positioned on the right place. It is displayed over the centerfooter.
Code: Select all
 
sheet.PageSetup.LeftFooter = DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss");
sheet.PageSetup.RightFooter = "&C&P/&N";
sheet.PageSetup.CenterFooter = "Test";


results in this document footer:
footer.jpg
footer.jpg (6.33 KiB) Viewed 6251 times



3) Next to that, i have a question about the header/footer parts:
Is it possible to set the style of a header or footer? I would like to set the font. Is that possible?

if you need any additional information: just ask! :-)

Thanks in advance,

Johan
jslots
 
Posts: 48
Joined: Mon Jul 09, 2012 12:03 pm

Re: header and footer issues

Postby amy.zhao » Fri Aug 31, 2012 10:41 am

Dear Johan,

Thanks for your inquiry.

We have reproduced the issue #1 and #2, they are caused by our product, we are sorry for that and we will fix them whitin next week. After that, we will inform you.
For #3, we don't provide header/footer style, but we will research it and tell you whether we will add a new feature about that.

Best wishes,
Amy
e-iceblue support
User avatar
amy.zhao
 
Posts: 2263
Joined: Wed Jun 27, 2012 8:50 am

Re: header and footer issues

Postby amy.zhao » Tue Sep 04, 2012 10:03 am

Dear Johan,

Thanks for you waiting.
We provide you a demo which can generate Excel file 2007&2010 with image. But for xls 2003, there is a bug which we are working.
If you insert a image into header/footer, you need also to insert a placeholder "&G" into the header/footer text. Please see our demo, we insert 3 pitures into header.
In &C is a key, you could not use it in your header/footer text. "&P/&N" is ok.
We do not provide a API to set directly the style of header/footer, but you could use format control in your text, "&\"Arial Black,Italic\"&12&K204080Test" will set the text "Test" has font "Arial Black", italic, size = 12, color=#204080.

If you need save your xls file to Excel 2003 or you have any other question about this issue, please tell us.

Best wishes,
e-iceblue support
User avatar
amy.zhao
 
Posts: 2263
Joined: Wed Jun 27, 2012 8:50 am

Re: header and footer issues

Postby jslots » Wed Sep 05, 2012 8:41 am

Hi Amy,

Thanks for providing the information.
The image inside the header is working with the placeholder. Great!
The footer is positioned right when i remove the &C key.
I can set the style of the header/footer with the given format control. Thanks for this solution.

I am planning to save the document as 2003/2007/2010. Our customers have the choice to select the office version when creating the document. What is not working right when saving as 2003?

There is 1 issue that is not working as expected:
I add information to the excel document which has titles in the first row of each column. I want this information to be printed on each page as titlerow. I add the following code:

Code: Select all
sheet.PageSetup.PrintTitleRows = sheet.Rows[0].RangeAddress;


When i open the printpreview page, the first row is not printed on every page. Is my implementation incorrect or is it a bug?

Thanks in advance,
Johan
jslots
 
Posts: 48
Joined: Mon Jul 09, 2012 12:03 pm

Re: header and footer issues

Postby amy.zhao » Thu Sep 06, 2012 3:51 am

Dear Johan,

Insert a image into header/footer is not working right when saving as 2003. We are struggling to fix the bug, once it has been fixed, we will inform you immediately.
For the issue the first row is not printed on every page, we suggest you to try to use code1. If you want to add information in three or more rows , we provide you a solution, please check code2. Hope it can help you.
code1:
Code: Select all
//"$1:$1" will repeate the first row
sheet.PageSetup.PrintTitleRows = "$1:$1";

code2:
Code: Select all
//"$1:$3" will repeate row 1, row 2 and row 3.
sheet.PageSetup.PrintTitleRows = "$1:$3";


Best wishes,
Amy
e-iceblue support
User avatar
amy.zhao
 
Posts: 2263
Joined: Wed Jun 27, 2012 8:50 am

Re: header and footer issues

Postby jslots » Thu Sep 06, 2012 7:30 am

Hi Amy,

unfortunately, your solution about printing the titlerows is not working for me. I created a new project and i added the following code to test your solution:

Code: Select all
 private static void Main(string[] args)
        {
            Spire.License.LicenseProvider.SetLicenseFileName("license.elic.xml");

            Workbook workbook = new Workbook();
            workbook.CreateEmptySheets(1);
            Worksheet sheet = workbook.Worksheets[0];
            sheet.PageSetup.Orientation = PageOrientationType.Landscape;
           
            //Add TitleRow
            for (int i = 0; i < 5; i++)
            {
                CellRange r = sheet.Range[1, i + 1];
                r.Text = string.Format("TestTitleRow{0}", i);
                r.Style.Font.Size = 16;
                r.Style.Color = Color.Red;
            }
            sheet.Rows[0].AutoFitRows();
            sheet.Range[1,1,1,6].AutoFitColumns();
            sheet.PageSetup.PrintTitleRows = "$1:$1";
           
            //Add dummy data
            for (int i = 2; i < 40; i++)
            {
                for (int j = 1; j < 5; j++)
                {
                    CellRange r = sheet.Range[i, j];
                    r.Text = string.Format("R{0}C{1}", i,j);
                    r.Style.Font.Size = 12;
                }
            }
            workbook.SaveToFile(@"C:\temp\printtitletest.xlsx", ExcelVersion.Version2010);
        }


I am using Spire.Office version 2.3.5.
Can you do some research en tell me if you have the (red) titlerow printed on every print-preview page?

Thanks,

Johan
jslots
 
Posts: 48
Joined: Mon Jul 09, 2012 12:03 pm

Re: header and footer issues

Postby amy.zhao » Thu Sep 06, 2012 9:24 am

Dear Johan,

We have tested your code, and the result xlsx file has the (red) titlerow printed on every print-preview page. We use spire.license(v1.2.2.40)dll, spire.xls(v6.8.5.7040)dll for .net4.0 in Spire.Office version 2.3.5, we will give you the result xls file and printed pdf file, please check the attachment.

Best wishes,
Amy
e-icbelue support
Attachments
xlsx file and pdf file.zip
(34.5 KiB) Downloaded 237 times
User avatar
amy.zhao
 
Posts: 2263
Joined: Wed Jun 27, 2012 8:50 am

Re: header and footer issues

Postby jslots » Thu Sep 06, 2012 12:20 pm

Hi Amy,

Thats pretty weird. I used .Net3.5 which i changed to .Net 4.0. I updated the references so i use the same files as you do.
This does not solve my problem. I still cant set the titlerows.

Further research: its only happening when i save the document in 2007 or 2010. Officeversion 2003 has titlerows!
Can you provide me a the complete project-file in which you created those files?


Thanks in advance,
Johan
jslots
 
Posts: 48
Joined: Mon Jul 09, 2012 12:03 pm

Re: header and footer issues

Postby amy.zhao » Fri Sep 07, 2012 3:36 am

Dear Johan,

We do a test again, but we save the xls-document in ExcelVersion2003, ExcelVersion2007, ExcelVersion2010 which all have titlerows; all of the above is ok. We give you the result xls-document files and sample code, please check the attachment.

Best wishes,
Amy
e-iceblue support
Attachments
project-file.zip
(11.86 KiB) Downloaded 214 times
User avatar
amy.zhao
 
Posts: 2263
Joined: Wed Jun 27, 2012 8:50 am

Re: header and footer issues

Postby jslots » Fri Sep 07, 2012 8:11 am

Hi Amy,

Thanks for sending me these files.
When i open your 2007 and 2010 files there aren't any titlerows printed on the 2nd page. I understand that you have titlerows printed on every page? Weird!
When i open the (2010) excelfile, which you send me, the "Rows to repeat at top" is empty. This should be filled with data. Can please check if this this field is filled when you open this file? See the enclosed picture:
image43.png
image43.png (74.81 KiB) Viewed 6207 times


So, next week i have the opportunity to test the files on office 2007 and office 2003 dedicated servers.
Just to ensure that it's not issue with my office installation.

Have a great weekend.
Johan
jslots
 
Posts: 48
Joined: Mon Jul 09, 2012 12:03 pm

Re: header and footer issues

Postby amy.zhao » Fri Sep 07, 2012 8:52 am

Dear Johan,

We have checked our xls files, the field which you pointing out is filled in page setup. We will provide you our screenshots.


Best wishes,
Amy
e-iceblue support
Attachments
printtitletest2010.PNG
printtitletest2010.PNG (132.93 KiB) Viewed 6205 times
printtitletest2007.PNG
printtitletest2007.PNG (141 KiB) Viewed 6205 times
printtitletest2003.PNG
printtitletest2003.PNG (131.68 KiB) Viewed 6205 times
User avatar
amy.zhao
 
Posts: 2263
Joined: Wed Jun 27, 2012 8:50 am

Re: header and footer issues

Postby amy.zhao » Thu Sep 27, 2012 3:25 am

Dear Johan,

Thanks for you waiting.
About the bug don't add images into header/footer in ExcelVersion2003, we have fixed it, please download Spire.XLS Pack Hotfix Version:6.8.7 from the link http://www.e-iceblue.com/Download/download-excel-for-net-now.html.

Best regards,
Amy
e-iceblue support
User avatar
amy.zhao
 
Posts: 2263
Joined: Wed Jun 27, 2012 8:50 am


Return to Spire.XLS

Who is online

Users browsing this forum: No registered users and 0 guests