Results 1 to 6 of 6
  1. #1
    trill is offline Member
    Join Date
    Jul 2007
    Posts
    40
    Rep Power
    0

    Default Export data to xls

    Hello, I made export option in my application, in which i send data dynamically from java application to excel. Same thing i did with html,word and PDF. All this options working fine except excel option while taking print out. When data length is more it increases the width not height in case of excel.

    How can i force excel cell to be a constant in length n increases height as per the size of data?

    Thanks.

  2. #2
    zoe
    zoe is offline Member
    Join Date
    Jul 2007
    Posts
    40
    Rep Power
    0

    Default

    This can be done using xsl/xml. To force a cell to wrap add a ss:Vertical="Bottom" ss:WrapText="1" style to the cell. To keep a constant width add the attributes: ss:AutoFitHeight="0" ss:Height="46.5". I only know this because I needed some special formatting for my exported data in excel and found this article. Of course it didn't have the formatting I needed but if you make a change to the excel file then save as xml you can see what attributes you will need to add to perform the desired formatting.

    The article is for asp.net but the xml/xsl will apply to any programming language. Just curious, what format are you sending your data for the other export options?

  3. #3
    Join Date
    Nov 2007
    Posts
    4
    Rep Power
    0

    Default export to excell

    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFCellStyle cellStyle = wb.createCellStyle()
    HSSFSheet sheet = wb.createSheet("sheet 1");

    //You can make the cell to wrap the text. Automatically the height will increase
    cellStyle.setWrapText(true);

    //Alternativelly, you can force the cell width.
    //setColumnWidth((short)ColNumber,(short)Column width)
    example

    sheet.setColumnWidth((short)(col-1),(short)4000)

    Thanks,
    Sanjay Sharma

  4. #4
    itzbobi is offline Member
    Join Date
    Sep 2009
    Posts
    3
    Rep Power
    0

    Default

    hi, has anyone worked on ireport 3.6.0 .
    My program just works fine with ireport3.5.0. But giving error when i call a jrxml file which is developed using new version.
    I got a runtime error . Can anyone help me.

    error:

    Exception in thread "main" java.lang.AbstractMethodError: org.codehaus.groovy.control.CompilationUnit$Classg enCallback.call(Lorg/objectweb/asm/ClassVisitor;Lorg/codehaus/groovy/ast/ClassNode;)V
    at org.codehaus.groovy.control.CompilationUnit$10.cal l(CompilationUnit.j
    ava:727)
    at org.codehaus.groovy.control.CompilationUnit.applyT oPrimaryClassNodes(
    CompilationUnit.java:924)
    at org.codehaus.groovy.control.CompilationUnit.compil e(CompilationUnit.j
    ava:462)
    at net.sf.jasperreports.compilers.JRGroovyCompiler.co mpileUnits(JRGroovy
    Compiler.java:88)
    at net.sf.jasperreports.engine.design.JRAbstractCompi ler.compileReport(J
    RAbstractCompiler.java:192)
    at net.sf.jasperreports.engine.JasperCompileManager.c ompileReport(Jasper
    CompileManager.java:219)
    at Jreport.main(Jreport.java:65)

  5. #5
    Fiona29 is offline Member
    Join Date
    Feb 2011
    Posts
    1
    Rep Power
    0

    Default

    I want to introduce you an article about export data to different format files.
    Data Export from Database to Excel, PDF and Word for .NET without Automation and Acrobat Reader - CodeProject
    It shows the method to use a small to export data.
    Also, you can try to download add-in to help you. I know that Spire.DataExport published the free component.
    If you are interested in it, you can visit
    VB.Net Excel, Pdf, Word Data Export Component - Spire.DataExport to get more information

  6. #6
    itzbobi is offline Member
    Join Date
    Sep 2009
    Posts
    3
    Rep Power
    0

    Default exporting data to different file formats

    thanks for the link. Very helpful

Similar Threads

  1. export to excel
    By diana glz in forum Advanced Java
    Replies: 0
    Last Post: 03-13-2008, 11:01 PM
  2. export to excel
    By diana glz in forum New To Java
    Replies: 0
    Last Post: 03-13-2008, 09:26 PM
  3. Export excel issue
    By sanjay_sharma77 in forum Advanced Java
    Replies: 0
    Last Post: 01-10-2008, 03:47 PM
  4. Export to Java program, applet or c/c++
    By fernando in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 06:55 AM
  5. problem with the way to export data to CSV file
    By gonne in forum Java Servlet
    Replies: 0
    Last Post: 07-01-2007, 02:43 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
  •