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
Similar Messages
-
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,
PramodYou'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 .
-
Number Formatting in Excel using HSSF POI
Hi,
I am downloading some data into the Excel file using hssf poi and I do my number formatting(either rounded,unrounded or general etc.) in java. The problem is that after the Excel file is created, the values in it behave like text though it shows the format as number. I am not able to plot any graphs or do any mathematical calculations using it. I need to convert it using "=VALUE(data)" before I do so.Is there anyway I can rectify this in the API itself?
Your suggestions will be very helpful.
Thanks.http://jakarta.apache.org/poi/hssf/quick-guide.html#CellTypes ?
Otherwise, Apache POI has a mailing list... -
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. -
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... -
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 -
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
ThanksMinOP 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... -
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?
:-)LisaI 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.
-
Messy format exporting to excel and text/html
Need help please....i'm in the middle of problems, i'm developing application that can exporting reports to some formats like pdf, excel, and text/html. it is become a problem when i exporting it to excel or text/html, the format are so messy... I'm using POI library 2.0 when exporting to excel. My codes are simply like this :
try {
response.setContentType(type);
if ("application/vnd.ms-excel".equals(type)) {
exporter = new JRXlsExporter();
exporter.setParameter(JRXlsExporterParameter.JASPER_PRINT,jasperPrint);
exporter.setParameter(JRXlsExporterParameter.OUTPUT_STREAM,response.getOutputStream());
else if ("text/html".equals(type)) {
exporter = new JRHtmlExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT,
jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_WRITER,response.getWriter());
is it just because the library? or i have to add some additional code before jasper reports execute it? thanks a lot for the answers....
Message was edited by:
darma_sadha
Message was edited by:
darma_sadha
Message was edited by:
darma_sadhaFirst, you forgot to tell what the problem is. Second: this is not a Jakarta product support forum. POI has a mailing list of its own. Go ask them.
-
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.
AShviniNO, 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? -
Hi All,
Does anyone know how to launch Excel file in HTML or jsp?
Wait...i know one method to open Excel fiel using
Window.open(blah...blah..)
In this case we can specify toolbar option..
But in my application i am loading excel file in frame.But frame doesnt have any option to set toolbar.....
Please let me know if you have soln for this....
Regards,
SuryaHi,
I can open excel file using window.open...but my requirement is forcing me to open it in frame....And i m able to open it properly in frame...but i want toolbar to come along with that frame...
according to folowing lin they say it is not possible have scenario like this...
http://support.microsoft.com/kb/157353/EN-US/
Please see whether you can help in this regard... -
Convert the report into excel/webi/pdf/HTML
Hy ,
I am Using the DESKI 6.5V.
How can i convert the deski report to webi report through which tool?
how we can save the result of the deski report in excel format/PDF/HTML wth extension .xls/PDF/HTML...........
plz help me in this............
thanks
Ravii dont know much about 6.5
but its good to have a XI version
i advice you to have the latest BO versions XI 3.1 SP3, as BO XI 4.0 will come by the end of this year so you will be in line with the new technology
wish you the best.. -
POI-HSSF problem. saves in /runtime/bin, not /wwwroot
I am trying to get this to work in Solaris/Apache/MX7. When I
run the code, it always saves the files in
<cfusionserver>/runtime/bin/
with owner "nobody|other"
i need the files to read and write from
<cfusionserver>/wwwroot/
owner "www|www"
any suggestions?
files located in <cfserver>/WEB-INF/lib/
-rw-r--r-- 1 www www 802216 May 16 09:42
poi-2.5.1-final-20040804.jar
-rw-r--r-- 1 www www 55209 May 16 09:42
poi-contrib-2.5.1-final-20040804.jar
<CFSCRIPT>
workBook=createObject("java","org.apache.poi.hssf.usermodel.HSSFWorkbook").init();
newSheet=workBook.createSheet();
workBook.setSheetName(0, "My First Sheet");
row=newSheet.createRow(55);
cell=row.createCell(0);
cell.setCellValue("hello world!");
fileOutStream =
createObject("java","java.io.FileOutputStream").init("test6.xls");
// ****** output
workBook.write(fileOutStream);
fileOutStream.close();
</CFSCRIPT>
I have tried using
.init("/opt/coldfusionmx7/wwwroot/test6.xls"); but i get an error.
Thanks if you can help
Davealso, you might try creating a file object first, initing
that with your
full path, and then passing that object into the init method
of the output
stream
"Marc E" <[email protected]> wrote in message
news:e4dlop$3t4$[email protected]..
> what error do you get when trying the init("/opt....")?
>
> that's on the right track...just using the filename
itself is definitely
> not what you want.
>
> what you might do to get the full path you're looking
for is create a file
> in wwwroot and do a
>
<cfoutput>#getDirectoryFromPath(getCurrentTemplatePath())#</cfoutput>
>
> that'll tell you what coldfusion thinks it is, and from
there you should
> have what you need to pass into the file init
>
>
> "DaveF67" <[email protected]> wrote in
message
> news:e4d0n6$6vh$[email protected]..
>>I am trying to get this to work in
Solaris/Apache/MX7. When I run the
>>code, it
>> always saves the files in
>>
>> <cfusionserver>/runtime/bin/
>> with owner "nobody|other"
>>
>> i need the files to read and write from
>> <cfusionserver>/wwwroot/
>> owner "www|www"
>>
>> any suggestions?
>>
>> files located in <cfserver>/WEB-INF/lib/
>>
>> -rw-r--r-- 1 www www 802216 May 16 09:42
>> poi-2.5.1-final-20040804.jar
>> -rw-r--r-- 1 www www 55209 May 16 09:42
>> poi-contrib-2.5.1-final-20040804.jar
>>
>>
>> <CFSCRIPT>
>>
>>
workBook=createObject("java","org.apache.poi.hssf.usermodel.HSSFWorkbook").init
>> ();
>> newSheet=workBook.createSheet();
>> workBook.setSheetName(0, "My First Sheet");
>> row=newSheet.createRow(55);
>> cell=row.createCell(0);
>> cell.setCellValue("hello world!");
>> fileOutStream =
>>
createObject("java","java.io.FileOutputStream").init("test6.xls");
>> ******
>> output
>> workBook.write(fileOutStream);
>> fileOutStream.close();
>> </CFSCRIPT>
>> I have tried using
.init("/opt/coldfusionmx7/wwwroot/test6.xls"); but i
>> get an
>> error.
>>
>> Thanks if you can help
>> Dave
>>
>>
>>
>
> -
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
iveRefer 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. -
POI HSSF XML to Excel DataFormat Problem
Hiho,
I�ve got the following problem:
I want to create an Excel File from an XML File with POI and DOM4J. This works fine...
Now I want to create some cells with a currency value in it, on which I want to calculate.
Here�s my code:
HSSFSheet sheet = wb.createSheet(s);
HSSFDataFormat format = wb.createDataFormat();
HSSFCellStyle intStyle = wb.createCellStyle();
intStyle.setDataFormat(format.getFormat("(�#.##0,00);(�#.##0,00)"));
for (cellit = rowelement.elementIterator(); cellit.hasNext();) {
cellelement = (Element) cellit.next();
String value = cellelement.getStringValue();
cell = row.createCell(columnnum);
s = cellelement.attributeValue("numeric");
if (s != null) {
cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
if (value != null)
cell.setCellValue(value);
cell.setCellStyle(intStyle);
...I always get a value with a prefixed apostrophe in Excel, which says that there�s an int value in a string cell (I think). Has anyone an idea whats wrong with my code? Thankshttp://jakarta.apache.org/site/mail2.html#poi
Maybe you are looking for
-
how can i play an AVI movie file on my macbook??????
-
HT1338 upgrade to mac os 10.7.5
Hi, I am trying to update my Macbook pro software to Mac OS X 10.7.5. I did software update and it tells me that my mac is uptodate. The reason that I want to do this is because My iPhoto update from app store is not downloading because my mac is not
-
Base page button submit causing Lov Controller procesRequest being called
Hello, I have created programmatic LOV's to my base page to which I set to declarative LOV region. I run my page, provide value to one of the LOV and trigger LOV page open, select value and the value gets populated to my base page LOV item. Now I cli
-
Hi, I have an iMac 3.06 Ghz Intel Core 2 Duo with 4gb of memory. I plan to play this game: http://anno.uk.ubi.com/pc/index.php I was trying the demo and I was getting all kinds of sluggish performances. These are the suggested requirements: suggested
-
Databases are deleted when report is closed in Sage PFW
I am using Crystal Reports 10 with Sage PFW. I created an Access Database using Microsoft Access 2003. I am using Sage PFW 5.71. The report works well when running it from Crystal Reports, but when I run the report through Sage PFW, the database is d