Results 1 to 6 of 6
  1. #1
    mermaid is offline Member
    Join Date
    Jan 2011
    Posts
    3
    Rep Power
    0

    Default Excel - Print Titles - jxl

    Hi. This is for anybody that knows JXL. Still trying to figure out how to make setPrintTitles() work properly.


    workbook = Workbook.getWorkbook(new File("output2.xls"));

    WritableWorkbook workbookFinal = Workbook.createWorkbook(new File("output3.xls"), workbook);

    WritableSheet sheet3 = workbookFinal.getSheet(0);
    sheet3.getSettings().setPrintTitlesRow(0,1);

    workbookFinal.write();
    workbookFinal.close();


    The very first time "output3.xls" is created, where file "output2.xls" has no Print Titles set, everything works fine. Then let's say I want to take "output3.xls" and override it. So I change the code to the following:

    workbook = Workbook.getWorkbook(new File("output3.xls"));

    WritableWorkbook workbookFinal = Workbook.createWorkbook(new File("output3.xls"), workbook);

    WritableSheet sheet3 = workbookFinal.getSheet(0);
    sheet3.getSettings().setPrintTitlesRow(0,1);

    workbookFinal.write();
    workbookFinal.close();

    Green represents which parts I changed when I executed the code a second time. This effectively opened "output3" and wrote over it. When I tried to open the file, I got this error:


    "Name cannot be the same as a built-in name.
    Old name: Print_Titles
    New name:"

    For some reason, if Print Titles have been set in an *.xls file and a JXL code re-writes it, something in the file gets screwed up. Now mind, I know what this error is. What I'd like to know is if anybody found a way around it.

    THANK YOU!!

  2. #2
    palnika is offline Member
    Join Date
    Jun 2011
    Posts
    2
    Rep Power
    0

    Default

    Hey, were you able to solve this?? I am having the exact same problem. I tried many jxl classes, like NameRecord, BuiltinName etc, but cant seem to resolve this Name Conflict issue.!

    Thanks in advance.

  3. #3
    mermaid is offline Member
    Join Date
    Jan 2011
    Posts
    3
    Rep Power
    0

    Default

    I did find out the solution for this but I can't remember off the top of my head. I'll reply again when I look into my documentation. Cheers!

  4. #4
    palnika is offline Member
    Join Date
    Jun 2011
    Posts
    2
    Rep Power
    0

    Thumbs up

    Hey, thanx for the reply, but i found it.! something to do with the properties.!

  5. #5
    Cifer69 is offline Member
    Join Date
    Sep 2011
    Posts
    1
    Rep Power
    0

    Default Re: Excel - Print Titles - jxl

    Hands down to you guys. This problem has been pestering me for days! I was wondering how you guys solved this?

    Please guide me to the right path.

    Thanks in advance!

  6. #6
    rtstone is offline Member
    Join Date
    May 2012
    Posts
    3
    Rep Power
    0

    Default Re: Excel - Print Titles - jxl

    Quote Originally Posted by palnika View Post
    Hey, thanx for the reply, but i found it.! something to do with the properties.!
    Please tell me what the solution you found was. I have been trying to solve this same problem for a while now, and I can't seem to figure it out.

    Thanks

Similar Threads

  1. Name titles help
    By Kak75 in forum New To Java
    Replies: 18
    Last Post: 12-19-2010, 04:01 PM
  2. JSP and Excel
    By mohammedsiddig in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 09-25-2008, 12:03 PM
  3. Print the text file and print preview them
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-23-2008, 12:04 AM
  4. jsp excel
    By lak in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 03-29-2008, 11:53 AM
  5. CSV column titles
    By javaplus in forum New To Java
    Replies: 2
    Last Post: 01-24-2008, 04:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •