POI- HSSF Excel Page Orientation

Hello
Does anyone know if you can set the page orientation of an Excel sheet using POI's HSSF?
Thanks in advance
ive

Refer to the POI documentation http://jakarta.apache.org/poi/apidocs/index.html
HSSFSheet.getPrintSetup() will give the page settings as a HSSFPrintSetup object. There are setter methods available to orient the page as you need.

Similar Messages

  • POI HSSF Excel 2002 Data error

    Hello,
    I'm using HSSF 3.0.2 Final version to create an excel document from java.
    This document contains pictures and some text under each picture in a row below. There are four sheets in the workbook and each contains about 30-40 pictures.
    I can create document fine and I can open it with Excel 2000,
    but when I try to open it with Excel 2002 and gives me data error.
    My understanding is that 2002 is supported and it seems to be a simple enough document without any fancy features
    Any idea what could be wrong?

    You can post your error and excel file to poi's mailing list.
    http://poi.apache.org/mailinglists.html

  • Excel File Management Apache POI HSSF vs. jxl jar

    I've been reviewing Java technologies for managing Excel files, and I'm a little confused about the differences between Apache's POI HSSF implementation and JExcelApi, and utimately what technology it makes sense to use.
    They are both open source, although POI is backed by Apache, where JExcelApi seems to be open source developed by Andy Khan. It seem Apache has a little more weight, therefore may be a better option.
    Can someone who has exposure to these technologies please provide me with some insight.
    Thanks.

    Hi
    Thanks for your reply,
    Now I hav used an alternate approach of using Apache POI.
    But.......
    I have created simple table in jsp and set content type to
    <%@ page contentType="application/vnd.ms-excel" %>
    when i navigate to this jsp it is getting displayed in excel format.
    I wish if user clicks on to navigate for this jsp, he must get an option to either open, save or cancel the jsp.
    Then on selecting save a dialogue gets appeared where he can select path and file name.
    Please comment.
    Thanks.

  • PDF From Excel File Page Orientation Problem

    Hi and thank you for your time to read about this problem!
    I have a workbook in Excel 2003 that has multiple worksheets that I am Itrying to convert to PDF for distribution.  One worksheet in the workbook is set to 11x17 Landscape--all the other worksheets are Letter size and portrait. All pages have the same margin settings.  I am running Acrobat 8 Professional.
    I have tried Excel's Send to Recipient as PDF, as well as the "Convert to PDF" option on the PDF menu in Excel.  In both cases the PDF file is converted perfectly when viewed on screen.  All page sizes and page orientations are correct when viewed on-screen.
    The problem occurs when the PDF file is printed.  No matter what the file looks like on screen the first page that prints out is landscape instead of portrait.  All of the following pages print fine.  Even if I skip page 1 and print pages 2-7, the first page out of the printer has the wrong page orientation.
    If we ran into this problem consistently across our PDF files I would say it's a printer issue, but I haven't seen this behavior before.  I make PDF's from pretty much all of the Microsoft and Adobe products and this is the first time I've ever seen this happen.
    Any ideas?
    Thank you!

    The machine I'm running it on is NTFS...
    Have found the problem though and it's got nothing to do with Acrobat!
    Basically the 80th sheet in the workbook had its Print Quality setting set to something different (higher resolution in this case) from the other sheets. I guess Acrobat saw that and realised it would have to create a new pdf with higher quality settings and so split the file in two when it hit that sheet. I assume a similar thing would happen if you changed the paper size half way through too.
    Anyway, problem solved. Hopefully this post will help someone who's equally confused in the future!
    Many thanks,
    Ben.

  • Inserting an Image in Excel with POI HSSF

    Has anyone been successful creating an Excel document with an
    embedded image using POI HSSF?
    Create a nicely formatted Excel is no, problem - but I can't
    seem to figure the image part out. I am not calling the loadPicture
    correctly, which is confusing CF.
    <cfset patriarch = newSheet.createDrawingPatriarch()/>
    <cfset patriarch.createPicture(createObject("java",
    "org.apache.poi.hssf.usermodel.HSSFClientAnchor").init(),
    loadPicture("asset/images/logo_e2eA.png",
    workSheet))/>

    MinOP wrote:
    > but I can't seem to figure the image part out. I am not
    calling the loadPicture correctly, which is confusing CF.
    You did not mention which version of POI. Did you verify your
    version supports the patriarch.createPicture method? If you are
    using a really old version it might not.
    > loadPicture("asset/images/logo_e2eA.png",
    workSheet))/>
    Does the code actually have access to a loadPicture() method
    or function? I think loadPicture() is a private method in one of
    the example classes: org.apache.poi.hssf.usermodel.examples.*. So
    you may have to write your own version of it. Assuming you have not
    done so already...

  • Poi hssf api to generate MS-Excel file

    I am using apache's poi hssf api to generate an excel file. Is there any way I can FREEZE PANES of excel sheet.
    thanks,
    Pramod

    You're wanting to make certain areas of your spreadsheet un-editable, yes? POI currently does not support this, as mentioned in the FAQ: http://jakarta.apache.org/poi/faq.html#faq-5 .

  • Excel Parsing -org.apache.poi.hssf.record.RecordFormatException

    Hi ,
    I am running into org.apache.poi.hssf.record.RecordFormatException,
    while creating excel work book.
    Few of the worksheets in the workbook are password protected.
    If i remove the password proted worksheets then i am able to load the
    workbook and can parse it.
    I am using apache poi 2.5.1.
    Is it possible to load workbook having few password proted sheets using apache POI?
    I appreaciate any help in this.
    Thanks in advance
    Mark
    code.
    POIFSFileSystem fs =new POIFSFileSystem(input);
    HSSFWorkbook wb = new HSSFWorkbook(fs);
    Exception log:
    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:80)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java(Compiled Code))
    at java.lang.reflect.Constructor.newInstance(Constructor.java(Compiled Code))
    at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java(Compiled Code))
    at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java(Compiled Code))
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:163)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:130)
    at com.cargill.aim.examples.ExcelParseTest.main(ExcelParseTest.java:43)
    Caused by: java.lang.ArrayIndexOutOfBoundsException
    at java.lang.System.arraycopy(Native Method)
    at org.apache.poi.hssf.record.UnknownRecord.<init>(UnknownRecord.java:62)
    at org.apache.poi.hssf.record.SubRecord.createSubRecord(SubRecord.java:57)
    at org.apache.poi.hssf.record.ObjRecord.fillFields(ObjRecord.java:99)
    at org.apache.poi.hssf.record.Record.fillFields(Record.java(Compiled Code))
    at org.apache.poi.hssf.record.Record.<init>(Record.java(Compiled Code))
    at org.apache.poi.hssf.record.ObjRecord.<init>(ObjRecord.java:61)
    ... 9 more
    Exception in thread "main" org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance, the following exception occured: null
    at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java(Compiled Code))
    at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java(Compiled Code))
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:163)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:130)
    at com.cargill.aim.examples.ExcelParseTest.main(ExcelParseTest.java:43)

    Hi,
    I am dealing with the similer problem but the same error. I am using the latest version of POI 3.0.1 and trying to read the cells which have auto formating enabled for date. I am getting the same error. Please let me know if you come across any solution to read the formatted cells using POI.
    Thanks in advance!
    - Alok

  • Excel - POI-HSSF - HTML

    Hey guys,
    Im looking for a way to copy an excel file and convert it into a html file. I have found a way to read excel files using POI-HSSF (Fantastic tool by the way). What Im wondering is now that I have the worksheets contents stored in java is there any kind of library that you would recommend that might generate the tables ripped from Excel to HTML automatically?
    Thanks for your help in advance
    Valehru

    YoGee,
    Thanks for the response. Im afraid that the client has insisted that I convert the document to html. I presume that if it was streamed out that it would open an excel worksheet in the browser itself?
    If anyone has any suggestions please let me know. Personally id prefer that they use openoffice and just convert the thing to a pdf but as they say the customer is always right. Im pretty sure that It will take me a fair bit of time trying to parse the data I receive via HSSF into proper valid HTML which looks similar if not identical to the data in the excel file.
    Thanks again for your reply

  • Inserting gif/jpeg image into excel through POI-HSSF

    HI,
    I am using jExcel to generate xls file from java. But I have to include image into the excel sheet. but jExcel supports only PNG file format to insert into excel sheet.
    what about POI-HSSF? Does it support inserting images into Excel or not. if supports what type of images it will support?
    I am in urgent need of it. Help me out in this issue
    Thanks

    MinOP wrote:
    > but I can't seem to figure the image part out. I am not
    calling the loadPicture correctly, which is confusing CF.
    You did not mention which version of POI. Did you verify your
    version supports the patriarch.createPicture method? If you are
    using a really old version it might not.
    > loadPicture("asset/images/logo_e2eA.png",
    workSheet))/>
    Does the code actually have access to a loadPicture() method
    or function? I think loadPicture() is a private method in one of
    the example classes: org.apache.poi.hssf.usermodel.examples.*. So
    you may have to write your own version of it. Assuming you have not
    done so already...

  • HOw to implement POI -HSSF in JSP

    Hello Everybody,
    requirement: I have to generate reports of the output from a jsp into excel spreadsheet.
    what i did: Changed the Content type to
    response.setContentType("application/vnd.ms-excel");
    I am getting the output in Excel. But, it is taking long time to display.
    I have searched in the net. I got the information that, i can use POI-hssf to generate Excel report.
    Can any one who have experience on this POI-hssf implementation, could guide me?I couldn't understand details as to what other factors i need to look upon to start using this api in my project. ?!
    Regards.
    AShvini

    NO, Pgeuens !
    What i mean is :
    I have droped idea of using HSSF in my code. I am NOT
    going to use it.
    I can't do it, because, for each user, their
    requirement will be different and input will be
    different for the report. I can't assume all the
    possible inputs and prepare the report in advance !This doesn't seem to be a good reason to drop the idea. Why don't you design a generic interface +class which will allow the report generation as per a set of defined rules?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • PDFMaker changes page orientation when printing to pdf

    Hi all! I am praying for an answer. My job requires me to convert huge word documents to pdf using the pdfmaker add-in with acrobat Professional 8.1.3. My problem is as follows and has occured in two seperate documents. I have Microsoft word 2007 and run on a VIsta OS.
       So my problem is when I create a pdf from word acrobat for some odd reason changes any page's orientation that contain excel spreadsheets that have been inserted (I believe through copy and paste and they are not linked to excel). Thus I get a page with a landscape spreadsheet with a profile orientation and it cuts off the information for my client. By the way, it does the complete opposite of whatever orientation I choose.
       Here are some things I have tried: I tried saving document as a 97-2003 word file and create pdf from that version, I have changed the PDFmaker advanced settings for auto-rotate pages and tried all three options to no avail. I really need some help fast! I will love anyone who solves this problem for me.
    Thanks,
           Jason.

    GREAT NEWS!!! I FIGURED IT OUT!!!!
      Okay so after a lot of frustration and mountain dew I have figured this out, but first the problem is simpler then I listed it. So here is the actual problem:
    I had a document with multiple sections and one section was oriented landscape while the rest were profile. When printing to PDF the resulting pdf file had all sections in profile and ignored any change in orientation and cut off/cropped out elements of the pages I had in landscape orientation.
    SOLUTION:
    The solution to this problem is in two parts: 1) changing some print preview stuff in word, and 2) changing preferences in pdfmaker/acrobat ribbon.For this solution to actually work however you must have the landscaped sections sectioned off by inserting section breaks in word.
    Step 1) Go to the section where you document orientation is changed from the rest of the document. Press the office button (in 2007) and drag down to print>print preview. You will notice that your section has now reverted to profile. (Ah Ha!) Change the page orientation to landscape.
                "But wait, now my margins or elements are getting cut off" you say. Go to Page setup. Make sure that near the bottom it says "Apply to: This section"
                Now make it landscape and this changes the margins to also be landscape.
    Step 2) Click on your Acrobat tab and go to preferences. Under pdfmaker settings click advanced settings and as Bill and I have said change auto-rotate pages to individually.
    AND YOU ARE DONE!!!!!

  • POI-HSSF or Cocoon?

    Hi,
    In our system we have one webb client and one Java application client.
    They both comunicate with the server through 2 difftrent servlets.
    Now I want to implement a method that creates Excel-files on the
    server that both the clients can call.
    I have found information about POI in this forum. When I went to
    http://jakarta.apache.org/poi/hssf/index.html to check it out I read a
    recomendation to use Cocoon instead:
    "If you're modifying spreadsheet data then use the usermodel api. You can also generate spreadsheets this way, but using Cocoon (which will do it this way indirectly) is the best way...we promise."
    So I read about Cocoon too and now I am really confused!!!
    Will they stop developing POI-HSSF?
    Is Cocoon only for webb aplication?
    Can someone please help me?
    :-)Lisa

    I thought Cocoon was a tool for transforming XML into something else. You can probably use Cocoon's ability to transform XML (using POI) into Excel I guess, but Cocoon is not a tool to create Excel spreasheets no.

  • Auto adjustment of page orientation causes printing issues with documents that have a page width greater than its page height.

    Hi,
    Since an upgrade from Word 2003 to Word 2010, we are experiencing printing issues with certain
    documents that have a page width greater than its page height.
    In Word 2003, it was no problem to set the page width greater than the page height while setting the page orientation to "portrait".
    In Word 2010, this seems impossible: despite leaving the page orientation to "portrait", if one changes the page width/height as stated,
    Word 2010 automatically adjusts the orientation to "landscape". Resetting the orientation to "portrait" will flip the page's width/heigth settings.
    This behaviour causes printing problems: the page prints out 90° rotated.
    I do not believe this is a printer driver issue: I tried several different printer drivers, and all give the same (bad) result. Setting the printer driver's page orientation settings (before printing) makes no difference, as
    Word 2010 seems to force the page orientation settings.
    Inserting the documents 90° rotated is not an option, since it causes problems with the printing margins.
    This is very annoying, since we have to print official documents of a municipality (driver's licences).
    Is there a workaround for this issue?
    Regards,
    Laurent Grandgaignage
    Sysadmin Gemeentebestuur Stabroek, Belgium

    Hi
    Thank you for using
    Microsoft Office for IT Professionals Forums.
    From your description, we can follow these steps to test this issue
    Step 1: Repair Office 2010
    1.      
    Click
    Start, and then click Control Panel.
    2.      
    Click
    Programs and Features.
    3.      
    Click the
    Office 2010 program that you want to repair, and then click
    Change.
    4.      
    Click
    Repair, and then click Continue. You might need to restart your computer after the repair is complete.
    Step 2:
    Rename the global template (Normal.dotm)Follow the steps for the operating system that you are using:
    Windows Vista and Windows 7
    a)      
    Exit Word 2010
    b)      
    Click
    Start.
    c)       
    In the
    Start Search box, type the following text, and then press
    ENTER:
    1.      
    %userprofile%\appdata\roaming\microsoft\templates
    d)      
    Right-click
    Normal.dotm, and then click Rename.
    e)      
    Type
    Oldword.old, and then press ENTER.
    Microsoft Windows XP
    a)      
    Exit Word 2010
    b)      
    Click
    Start, and then click Run.
    c)       
    In the
    Open box, type the following text, and then press ENTER:
    %userprofile%\Application Data\Microsoft\Templates
    d)      
    Right-click
    Normal.dotm, and then click Rename.
    e)      
    Type
    Oldword.old, and then press ENTER.
    f)       
    Close Windows Explorer.
    How to troubleshoot print failures in Word 2010, Word 2007, and Word 2003
    http://support.microsoft.com/kb/826845
    Please take your time to try the suggestions and let me know the results at your earliest convenience. If anything is unclear or if there is anything
    I can do for you, please feel free to let me know.
    Hope that helps.
    Sincerely
    William Zhou CHNPlease remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Page orientation when combining multiple postscript files to a pdf file

    Hi
    I'm having problems with the orientation of my pages when I generate pdf's from multiple postscript files.
    I have 3 postscript files that need to be merged into 1 pdf, and they contain a mixture of portrait and landscape pages.
    To create the pdf, I use the following code (because i have lots and lots of pdf files to produce)...
    /prun { /mysave save def
         dup = flush
         RunFile
         clear cleardictstack
         mysave restore
    } def
    (D:/example/fileA.ps) prun
    (D:/example/fileB.ps) prun
    (D:/example/fileC.ps) prun
    ... however, when I run the above code (by saving the text file into the /in directory of a watched folder), whilst I get a pdf, the page orientation isn't right.  For some reason, the first few pages are oriented correctly, then after about page 7 everything is portrait no matter what.
    The funny thing is, when I simply double-click on one of the postscript files (eg. fileA.ps), distiller changes it to pdf and the orientation is perfect for each file separately (fileA, fileB, fileC).  Even when I run the above code for just one ps file it works.  But as soon as I put all 3 sub-files together it doesn't orient properly.
    I've tried activating and de-activating auto-rotate in the PDF settings, as well as the DSC options in the Advanced tab, and whilst these changes do affect the pdf I get when I simply double-click a certain postscript file, it seems to have no effect when I try to combine the 3 files with the code above.  I still end up with the first few pages oriented correctly, then after about page 7 everything is portrait.
    Hope someone can help.
    Danny

    Ok i successfully generated my PDF files.
    Now I'm having difficulties merging them. I use a DDX file named LiveCycleInput.ddx
    What I do (everything in LiveCycle Workbench):
    1) FileReader to open the .ddx file as a document (successfully)
    2) Store the read document in a process variable (successfully)
    3) Assembler.invokeDDX with following arguments:
    Document DDX = process variable (read in 2)
    OutputResult = "AssemblerResult" processVariable which has type AssemblerResult as specified by the documentation
    Errorlog
    Everytime I run the process I get the following stacktrace in my server's logfile:
    ... 119 more
    Caused by: com.adobe.internal.pdfm.CollateralNotFoundException: DDXM_S14017: A <PDF> source document is required, but no documents were found for {PDF source="testFileDoc.doc.pdf" baseDocument="true"}.
    at com.adobe.internal.ddxm.ddx.pdf.PDFSource.getOrderedInputDocs(PDFSource.java:595)
    at com.adobe.internal.ddxm.blueprint.pdf.SourceSegment.addDocumentsForAssembly(SourceSegment .java:91)
    ... 125 more
    The .ddx file is stored in the same path as my generated .pdf files are stored.
    Content of my DDX file (full copy paste)
    <DDX xmlns="http://ns.adobe.com/DDX/1.0/">
    <PDF result="testFileMerged.pdf">
      <PDF source="testFileDoc.doc.pdf"/>
      <PDF source="testFileJpg.jpg.pdf"/>
      <PDF source="testFileOdt.odt.pdf"/>
    </PDF>
    </DDX>
    Note that the DDX file is read from a network drive(!!) the source PDF files are in the same folder as the ddx file (hence no further path-links).
    Adding network paths to the source & result pdfs does not change a thing.
    All PDF Files apart from the result pdf fiile are present in that same folder
    I consulted the DDX reference multiple times and this is the simplest ddx that should work ... but it doesnt.
    Can anyone help me?

  • How can I use two different page orientations in the same document?

    I am trying to have both portrait and landscape page orientations in the same document.  Pages doesn't seem to like this.  Is there a way?

    I tried to comment on another thread about this same issue, but the thread was closed.
    In the other thread; however, some asked why rotating one pages was necessary, and if they knew then maybe there would be reason to create the function.
    Well, I don't know about why anyone else needs it, but for me it's for the papers I have to write for my masters program. The professors like to have the rubric attached to the bottome of the document so they easily grade and keep things organized. They of course give directions on how to easily change the orientation of the last page in Word, but not all of use Word, or even want to use Word. Maybe I need to ditch Pages and go to Word? I'd really hate to do that!
    So, come on Apple, let's get this feature added, stat!

Maybe you are looking for

  • Lumia 620 double images problem

    Hi! I bought my Lumia 620 few days ago, but theres one major problem with it. When adding images to Galley from my old phone there always appear 2 or 3 copies of one image. When deleting one of them they disappear all. Its the same case no matter if

  • My browser seems to crash quite a lot and Ive noticed a lot of you tube videos dont play back correctly and have a green bar across the screen

    Ive had the browser a couple of days now and I've noticed it crashes occasionally. Ive also noticed it doesn't play back videos off you-tube correctly and there is a green band going across them as they play. I think this may be an issue with adobe f

  • Developer 6.0 + Personal8i on NT

    Does anyone have any instructions on how to set this combination up on NT, I have tried to set this up but can get the Listener to work properly. I have tried using instructions that use a machine that has TCP/IP but with no Hostname or domain, my ma

  • Activation fail, broken DCs

    Hi, guru: we have a track call MRP, and Buildspace are: - MRP_C - MRP_D anyone can tell me what is MRP_C for. is that for consolidation? I checked landscape configurator, runtime systems, and consolidation system is not ticked. we have problem with a

  • Clarification on creating a Physical Standby Database

    I'm practicing with data guard with Oracle 10.2.0.1.0 on two Windows 2003 servers. I'm in the process of creating a physical standby database by following the steps outlined in the guide http://www.filibeto.org/sun/lib/nonsun/oracle/10.2.0.1.0/B19306