Re: HSSF SUM Formula support
http://jakarta.apache.org/poi/hssf/formula.html Hello First let me say that I use HSSF and it's realy fantastic staff. Is it possible to make formula cell like =SUM(B1:B5)? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: Why autoSizeColumn probably needs java.awt.headless=true
Rober, To calculate column width HSSFSheet.autoSizeColumn uses Java2D classes that throw exception if graphical environment is not available. However, some tasks such as computing text layout can be done in a headless mode, that is in the absence of graphical environment. To use headless mode you must set the following system property: java.awt.headless=true either via -Djava.awt.headless=true startup parameter or via System.setProperty(java.awt.headless, true). As Dave mentioned, there can be slight differences in the result: - Native graphical toolkits (WinXP or Unix with X11) are always more precise than the headless toolkit. The way the font metrics are calculated may be different in headless and headful modes. Moreover, it may different on different platforms, i.e. there can be minor differences between text metrics calculated under Solaris and under WinXP. That is why projects that require high-precision, platform-independent graphic calculations use their own mechanism to measure text (for example, Apache FOP). I don't think it's an issue in our case. Auto-sizing in Excel is a rough operation - user needs to APPROXIMATELY set column width to fit the text. - If some of the fonts are not available, JDK uses the default font. So if any fonts are missing in production you need to install them and copy font files to $JAVA_HOME/jre/lib/fonts/. P.S. It's good you raised this question. I'm going to update the docs to reflect it. Regards, Yegor DF Rober, DF As Andy says ask on the list. DF In your Tomcat startup on the unix server you need to be sure to set DF the following property - DF -Djava.awt.headless=true DF Do that and all should be good. DF If you notice slight differences in widths between windows and unix DF that may be due to the fact that autoSizeColumn uses fonts to do its DF magic. (Which is why it needs the graphic environment) So, then you DF might want to install fonts into /usr/java/jre/lib/fonts/ on the unix DF box. If you get stuck with that then you can ask again - Yegor can DF explain the exact rules. DF Regards, DF Dave DF On May 3, 2007, at 6:57 PM, [EMAIL PROTECTED] wrote: DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://issues.apache.org/bugzilla/show_bug.cgi?id=42331. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND· INSERTED IN THE BUG DATABASE. http://issues.apache.org/bugzilla/show_bug.cgi?id=42331 Summary: autoSizeColumn. Exception in non graphical environment Product: POI Version: 3.0-dev Platform: Other OS/Version: other Status: NEW Severity: normal Priority: P2 Component: HSSF AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] I developed a webapp that generates excel files. Development environment is Tomcat server under Windows XP. Production server is a Unix machine with no graphical environment. autoSizeColumn method, from HSSFSheet class, works ok in windows, but throws an exception in unix environment. The lack of graphical environment seems to be the reason. -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi? tab=email --- You are receiving this mail because: --- You are the assignee for the bug, or are watching the assignee. - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List:http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta POI Project: http://jakarta.apache.org/poi/ DF - DF To unsubscribe, e-mail: [EMAIL PROTECTED] DF Mailing List:http://jakarta.apache.org/site/mail2.html#poi DF The Apache Jakarta POI Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: hi all regarding introducing new methods
Hi, Follow instructions at http://jakarta.apache.org/poi/getinvolved/index.html Regards, Yegor RM Hi all RM i want to contribute to POI - HWPF RM Actually how i need to include my method in to API RM and what is the actual procedure RM what are all the conditions by jakarta.apache.org to include my methods in RM to their API RM i want the complete details please RM Cheers RM RAJ KISHAN - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: HSSFComment?
What release are you using? Try the latest RC3. You can download it from http://people.apache.org/~nick/POI-3.0-RC3/ HSSFComment is there. Regards, Yegor HL Hi everyone, HL I am having trouble locating HSSFComment in the current POI's HSSF HL release. There is already a HOW-TO on the site which does use HL HSSFComment. Has this not been released formally? any idea? HL Thanks, HL Herry HL - HL To unsubscribe, e-mail: [EMAIL PROTECTED] HL Mailing List: http://jakarta.apache.org/site/mail2.html#poi HL The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: HSSFComment?
What release are you using? Try the latest RC3. You can download it from http://people.apache.org/~nick/POI-3.0-RC3/ HSSFComment is there. Regards, Yegor HL Hi everyone, HL I am having trouble locating HSSFComment in the current POI's HSSF HL release. There is already a HOW-TO on the site which does use HL HSSFComment. Has this not been released formally? any idea? HL Thanks, HL Herry HL - HL To unsubscribe, e-mail: [EMAIL PROTECTED] HL Mailing List: http://jakarta.apache.org/site/mail2.html#poi HL The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: Encryption/password protected excel/word files
I wonder if Microsoft uses encryption compatible with javax.crypto.*. If yes, we have a chance to decode it. Otherwise it is not worth the trouble. Yegor NB On Tue, 17 Apr 2007, Justin Warren wrote: I should mention that the exceptions don't really tell if the files are password protected or not. For word, I catch an ArrayIndexOutOfBoundsException, or java.lang.NegativeArraySizeException. I'm guessing that is not the expected behaviour. NB With powerpoint, we did find one record we could look for early on that NB indicates if the file is encrypted or not. For the others, we haven't NB spotted anything suitable. NB The problem is that if the file is encrypted, lots of the core records are NB there, but there data is encrytped, and hence garbage if you try to read NB it as if it wasn't. Unless we can tell very early on that a file is NB encrypted, we can't just look through the record list looking for the NB encrypted record flag, since the parent records can't be read properly. NB Instead, we must find either a absolute offset to an indicator, or one NB non encrypted record at a given location that'll have a child that tells NB you it's encrypted. NB If someone encrypts both the properties and the document, it's easy, as NB you can tell at the poifs level. If they just encrypt the document, it's NB hard. See EncryptedSlideShow in hslf for an example of how to do it for NB powerpoint. Any suggestions for a similar way to do it for word or excel NB gratefully received :) NB Nick NB - NB To unsubscribe, e-mail: [EMAIL PROTECTED] NB Mailing List: http://jakarta.apache.org/site/mail2.html#poi NB The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: What is the correct method to read a large excel file line by line?
Hi, Current implementation reads the whole document into memory. There is no way to read excel files line by line. Regards, Yegor LS Using HSSF, what is the correct method to read large excel files line by LS line? LS In my real world situation the excel file will be very large, over 100 LS megs. I need to be able to read the file line by line so that the large LS file size does not cause memory issues. LS I have tried to use a BufferedInputStream to read in the file but that LS results in invalid header exceptions when I try to do a read(). I can LS use the BufferedInputStream as is if I give the whole thing to the LS workbook to process.However this pretty much forces me to read in the LS entire file at once does it not? LS If anyone has any examples, or can round about hint at what I need to do LS I would be most appreciative. LS Thank you, LS Levi - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: Auto fit height of cell values in MS Excel
Hi, You should turn on word wrapping. Create a cell style with setWrapText(true) and assign it to the cell. Yegor AB Hi all, AB Actually, I intend to make the height to fit the value of the cell. AB With best regards, AB Anjishnu. AB -Original Message- AB From: Anjishnu Bandyopadhyay [mailto:[EMAIL PROTECTED] AB Sent: Wednesday, April 04, 2007 11:29 AM AB To: poi-user@jakarta.apache.org AB Subject: Auto fit of cell values in MS Excel AB Hi all, AB I am generating an MS Excel sheet through POI. AB For a column in the sheet, I am specifying a width by using the method AB setColumnWidth(). Now, if the content of the cell is more, then, AB portions of the value in the cell are hidden. Is it possible to break AB the contents to the next line programmatically (the same effect that can AB be achieved by pressing Alt+Enter)? AB Thanks for your time. AB With best regards, AB Anjishnu. AB CAUTION - Disclaimer * AB This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended AB solely for the use of the addressee(s). If you are not the intended AB recipient, please notify the sender by e-mail and delete the original AB message. Further, you are not to copy, disclose, or distribute this AB e-mail or its contents to any other person and any such actions are AB unlawful. This e-mail may contain viruses. Infosys has taken every AB reasonable precaution to minimize this risk, but is not liable for any AB damage you may sustain as a result of any virus in this e-mail. You AB should carry out your own virus checks before opening the e-mail or AB attachment. Infosys reserves the right to monitor and review the content AB of all messages sent to or from this e-mail address. Messages sent to or AB from this e-mail address may be stored on the Infosys e-mail system. AB ***INFOSYS End of Disclaimer INFOSYS*** - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: Getting class file has wrong version error on poi-scratchpad-3.0-rc2 jar
Very strange. We have this setting in build.xml and it is -target 1.3! We should be compatible with 1.3+ JVMs. Nick, are you using the standard build.xml? Which JDK? Regards, Yegor AS even if compiling in 1.5, there is a setting to use backward compatible AS classfile format. We should just set in the ant buildfile for safety, so that AS we create correct builds irrespective of the java version on the release AS manager's machine. (this is assuming all source does compile in the older AS jdk, of course!) AS Separately, if you are interested in older versions of java, you should AS occasionally compile the source and report errors in your favourite jdk. It AS is very easy to check in non backward compatible stuff by mistake, depending AS on the jdk in one's machine... AS Regards AS - AS Avik AS On Friday 30 Mar 2007 5:38:40 am Karr, David wrote: I assume you're only half serious. Dropping 1.4.2 at this point would be a big mistake. In any case, I tried manually building the jars from source with JDK 1.4.2, and it works fine. -Original Message- From: Andrew C. Oliver [mailto:[EMAIL PROTECTED] Sent: Thursday, March 29, 2007 12:47 PM To: POI Users List Subject: Re: Getting class file has wrong version error on poi-scratchpad-3.0-rc2 jar yeah unless we've dropped 1.42 then it should be compiled on 1.42. So the last build is invalid or we need a vote to drop 1.42 and req 5+ -andy David Fisher wrote: That class file was compiled with JDK 5.0 See http://blogs.sun.com/sundararajan/entry/java_class_ic_errors On Mar 29, 2007, at 2:25 PM, Karr, David wrote: Obviously, I was wrong to refer to this as the scratchpad jar. It's the main poi jar. -Original Message- From: Karr, David Sent: Thursday, March 29, 2007 12:06 PM To: POI Users List Subject: Getting class file has wrong version error on poi-scratchpad-3.0-rc2 jar I'm trying to use 3.0rc2, and I'm trying to use the scratchpad jar for the first time. I'm using JDK 1.4.2. When I try to compile my code with Ant, I get the following: bad class file: ...\lib\poi-3.0-rc2-20070329.jar(org/apache/poi/hssf/model/Wor kbook.clas s) class file has wrong version 49.0, should be 48.0 Please remove or make sure it appears in the correct subdirectory of the classpath. import org.apache.poi.hssf.model.Workbook; - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ -- From Windows/Exchange to Linux/Meldware Buni Meldware Communication Suite Email, Calendaring, ease of configuration/administration http://buni.org - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ AS - AS To unsubscribe, e-mail: [EMAIL PROTECTED] AS Mailing List: http://jakarta.apache.org/site/mail2.html#poi AS The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: HSLF - Adding Picture is 133% of actual size
Hi, It's a bug. Before setting coordinates for a picture we need to convert from pixels (96 dpi) to points (72 dpi). Missing this results in the 1.33 factor. I will upload the fix today. Thanks for the report. Regards, Yegor HN Hi HN I'm adding a picture to new slideshow and it always seems to be scaling HN it to 133% of actual size. The picture is in the OutputStream os. HN int i = ss.addPicture(os.toByteArray(),Picture.PNG); HN Picture p = new Picture(i); HN s = ss.createSlide(); HN s.setSlideNumber(ss.getSlides().length); HN s.addShape(p); HN I've tried using the setDefaultSize() method on Picture and the HN setAnchor method of Picture to adjust sizing and positioning without HN success. HN Presumably I'm missing something very simple! Can someone point me in HN the right direction to set the picture size to the actual picture size HN (i.e. no scaling). HN Nick Havard - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: PPT Error on Writing Presentation
Create a bug in bugzilla and attach the ppt. We already had similar issues. So far we considered them as anomalies that are rare to happen. But now I'm inclined to think it's normal. Attach the file and we will see what can be done. Regards, Yegor HN Hi HN I am working with POI to manage some powerpoint presentations. A simple HN test, is giving me the following strange error. HN === HN Couldn't find the new location of the slide with id 223 that used to HN be at 19389 HN Not updating the position of it, you probably won't be able to find it HN any more (if you ever could!) HN === HN The code I am using is simply reading an existing ppt presentation and HN wrting it back out as a new file. HN To read file in. HN SlideShow ppt = null; HN ppt = new SlideShow(new HSLFSlideShow(c:\\files\nh.ppt)); HN To write file back out. HN FileOutputStream fos = new FileOutputStream(c:\\files\\njh.ppt); HN ppt.write(fos); HN fos.close(); HN The ppt that is being read in (nh.ppt), use to be a much larger ppt HN which I have trimmed down for the purposes of development and testing. HN The ppt has a single master slide (with title master) and three HN presentation slides. Is it likely that there are references to some of HN the deleted slides in the presentation hanging around. How can I work HN around this issue as its quite urgent to sort out? HN I am using a version of POI that I compiled myself from source HN downloaded from the subversion repository. HN Thanks for your help. HN Nick Havard - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: POI and Powerpoint Tables
Hi, Tables are not yet supported. I hope to implement it during this year. If it is now possible, is it simply a matter of creating a ShapeGroup and adding TextBox's at the appropriate grid coordinate. You can do it, but PPT won't recognize this group of shapes as Table. Table is a complex container containing special records. Regards, Yegor HN Hi HN Whilst searching the archives, I came across the following HN http://mail-archives.apache.org/mod_mbox/jakarta-poi-user/200608.mbox/%3 HN [EMAIL PROTECTED] which says creating tables is HN not yet supported. Give the age of the message (8 months), is creating HN tables now supported. HN If it is now possible, is it simply a matter of creating a ShapeGroup HN and adding TextBox's at the appropriate grid coordinate. HN Due to a bug I was hitting I have dowloaded and built the latest version HN of the jar files, and am not using the downloadable jar's. HN Thanks for your help. HN Nick Havard - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: problems with POI build
I use JDK 1.4.2 and JDK 1.5. To build POI users need JDK 1.4 or greater. It should be reflected it the docs somehow. Compilation under JDK 1.3 fails. I've just tried it and got 68 errors. Does it concerns you? Yegor AO Which JDK? AO Yegor Kozlov wrote: Hi, I don't quite understand what's wrong with POI. I'm using Ant 1.6.2 and it works fine for me. POI build.xml is all-sufficient. It downloads the required jars if they are missing. No intervention in Ant's config is required. Regards, Yegor LS Has anyone tested this with a newer version of ANT other than 1.5.3? LS LS From: Levi Strope [mailto:[EMAIL PROTECTED] LS Sent: Tuesday, March 20, 2007 11:07 AM LS To: poi-user@jakarta.apache.org LS Subject: problems with POI build LS I'm using ANT 1.7 and there is no optional.jars - has anyone worked LS through this before? LS Additionally - I did include all required .JARS per the 'How to Build' LS instructions - but I get an error telling me org.apache.xalan does not LS exist. It doesn't exist but I did include it in %ANT_HOME%/lib so I'm LS not sure what I need to do. - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ AO - AO To unsubscribe, e-mail: [EMAIL PROTECTED] AO Mailing List: http://jakarta.apache.org/site/mail2.html#poi AO The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: [POI- HSSF] Alignment issue in sizing the Cell automatically
VK Can i keep the image irrespective of the column size? No, you can't. Image anchor defines how many cells the image occupies. If you resize columns the image gets resized too. What POI lacks is the ability to edit anchors of existing shapes. Now you can set anchor only when shape is constructed. In other words you can't resize images that are already ion worksheet. Is it possible for you to defer inserting image until all columns are resized? Yegor VK ___ VK HSSFRow headerRow = sheet.createRow((short)0); VK sheet.addMergedRegion(new Region(0,(short)0,1,(short)6)); VK //Displaying Logo VK byte[] picData = null; VK File pic = new File(C:\\images\\excelLogo.jpeg); VK long length = pic.length(); VK picData = new byte[(int) length]; VK FileInputStream picIn; VK picIn = new FileInputStream(pic); VK picIn.read(picData); VK int index = workbook.addPicture(picData, VK HSSFWorkbook.PICTURE_TYPE_JPEG); VK HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); VK HSSFClientAnchor anchor = new VK HSSFClientAnchor(0,0,0,255,(short)0,0,(short)1,1); VK HSSFSimpleShape shape = patriarch.createPicture(anchor,index); VK shape.setShapeType(HSSFSimpleShape.OBJECT_TYPE_PICTURE); VK _ VK Please help me in this regard, VK Thanks, VK Vinay VK On 3/21/07, Yegor Kozlov [EMAIL PROTECTED] wrote: Hi, The POI 3.0 RC1 can be downloaded from http://people.apache.org/~nick/POI-3.0-RC1/ HSSFSheet.autoSizeColumn was added after 12-Dec-2006. Try the latest jar. Regards, Yegor VK Hi all, VK I'm new to this group. I'm trying to generate MS Excel from my java code. VK I'ts working great, but i have some alignment issue like the width of the VK cell is not enough to fit the text. VK i.e the cell width is not good enough to view the text that is displaying. VK I need to set the width size automatic (i.e something like AutoFit option) VK i.e the cell width should be set to max length of text value in that column. VK I walked through api of HSSF (poi) but i dont find any method to set the VK autoSize of the Column VK i have latest jar of poi-bin-3.0-alpha3-20061212 (12-Dec-2006) VK I have seen in couple of places that new method called autoSizeColumn() VK was added, but i don't see even in alpha build, is there any other build VK lately, VK Please provide me the link to download the latest jar of POI. VK Any Suggestions will be appreciated . VK Looking for any kind of help, i was in little bit urgency. VK Thanks, VK Vinay - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: [POI- HSSF] Alignment issue in sizing the Cell automatically
Hi, The POI 3.0 RC1 can be downloaded from http://people.apache.org/~nick/POI-3.0-RC1/ HSSFSheet.autoSizeColumn was added after 12-Dec-2006. Try the latest jar. Regards, Yegor VK Hi all, VK I'm new to this group. I'm trying to generate MS Excel from my java code. VK I'ts working great, but i have some alignment issue like the width of the VK cell is not enough to fit the text. VK i.e the cell width is not good enough to view the text that is displaying. VK I need to set the width size automatic (i.e something like AutoFit option) VK i.e the cell width should be set to max length of text value in that column. VK I walked through api of HSSF (poi) but i dont find any method to set the VK autoSize of the Column VK i have latest jar of poi-bin-3.0-alpha3-20061212 (12-Dec-2006) VK I have seen in couple of places that new method called autoSizeColumn() VK was added, but i don't see even in alpha build, is there any other build VK lately, VK Please provide me the link to download the latest jar of POI. VK Any Suggestions will be appreciated . VK Looking for any kind of help, i was in little bit urgency. VK Thanks, VK Vinay - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: Create Cell comments
Hi, p Is it already available in version 3 alpha? I can't find in the API p documentation and also when I tried, there is an error. Yes, cells comments are available in 3 alpha. What was the error? Regards, Yegor - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: HSSF Announcement: column autofit is implemented
Tahir, It's possible to do. Probably it will a a param telling the algorithm to preserve wide columns. I will look at it later. Thanks for the idea. Yegor TA Yegor, TA Is it possible to somehow auto-size only those columns that are not wide TA enough to display there content but leave those columns that are wider than TA required? I mean that I don't want to shrink the columns that can show there TA content even if they are wider than max width of content. TA Wassalam, TA Tahir -Original Message- From: Yegor Kozlov [mailto:[EMAIL PROTECTED] Sent: Monday, February 26, 2007 10:42 PM To: POI Users List Subject: HSSF Announcement: column autofit is implemented Hi All I'm pleased to announce that the autofit column width feature is implemented in HSSF. There were many requests to have it since the very beginning of POI and finally it is present. The implementation is pure Java2D and the result is pretty close to what excel calculates. Usage: To autofit a column just call HSSFSheet.autoSizeColumn(short column) as follows: HSSFSheet sheet; ... sheet.autoSizeColumn((short)0); //autofit the first column Important note: the fonts used in the xls being auto-fitted must be available. Otherwise Java will use default font and the result may be not correct. Regards, Yegor Kozlov - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ TA - TA To unsubscribe, e-mail: [EMAIL PROTECTED] TA Mailing List: http://jakarta.apache.org/site/mail2.html#poi TA The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: Need to merge PPTs
Hi, Unfortunately merging ppt slides is not as simple. PPT format has a global area where it stores the data shared among slides such as image data, fonts, etc. If you copy a slide with an image you must put the image data into this global area. The same thing is with text boxes. While copying text data you need to make sure all the fonts are registered in the ppt. So you see, it's not just copying of the raw data from source into the output. Anyway, I think HSLF has enough capabilities to do what you need. To me the task looks like replicating the source ppt. For each of the source slides you need to read shapes and re-create them in the target ppt. As you noticed, we don't yet support all the different shapes but it's not an issue for you. You don't need to interpret the shape properties and know the meaning of each of them. All you need is to copy ALL the shape props. If you are willing to contribute, welcome! It's not very hard to implement although it requires some knowledge of the ppt format. You can count on my help. Regards, Yegor JTS Hi! JTS We need to merge several PPTs into a single PPT -- each of the JTS original PPTs has a single slide with some simple shapes and images, JTS and each slide just needs to go straight into the output PPT. I JTS noticed an earlier thread on this topic saying that it's not quite JTS supported because HSLF doesn't yet support all the different complex JTS shapes. How close is it now? We're willing to contribute code if it's JTS close. In particular, I'm curious, is it possible to just copy the raw JTS data pretty directly from each source PPT into the output, without JTS necessarily knowing anything about the particular shapes and images JTS being used? That is, can we achieve the specific need of merging PPTs JTS without actually implementing all the different shapes and images in JTS HSLF? JTS Cheers, JTS Justin Sampson JTS (apologies if this comes through twice -- I suspect it was rejected JTS from another email address) JTS - JTS To unsubscribe, e-mail: [EMAIL PROTECTED] JTS Mailing List: http://jakarta.apache.org/site/mail2.html#poi JTS The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
HSSF Announcement: column autofit is implemented
Hi All I'm pleased to announce that the autofit column width feature is implemented in HSSF. There were many requests to have it since the very beginning of POI and finally it is present. The implementation is pure Java2D and the result is pretty close to what excel calculates. Usage: To autofit a column just call HSSFSheet.autoSizeColumn(short column) as follows: HSSFSheet sheet; ... sheet.autoSizeColumn((short)0); //autofit the first column Important note: the fonts used in the xls being auto-fitted must be available. Otherwise Java will use default font and the result may be not correct. Regards, Yegor Kozlov - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: Computing anchor size for easy image insertion?
There isn't an easier way do scale images. There was a discussion recently about scaling. Excel measures images in units of 1/256th of a character width of the default font. Conversion from these weird units to pixels is not trivial. It's the main problem. I have ideas how to add such support. Check POI in a month or two. There is a chance I will commit it. Yegor ÒÁV Hi all, ÒÁV I'm using Jakarta POI 3.0-alpha3 to write an Excel spreadsheet with ÒÁV images and I'm having some trouble computing the HSSFClientAnchor ÒÁV size. ÒÁV At the moment I try to manage it by adding column widths and row ÒÁV heights until I reach approximately the size of the image in cells, ÒÁV and then set up dx and dy, but I can almost never get it to work ÒÁV perfectly and images are never exactly at 100%. ÒÁV Is there an easier way to do this? I have searched around in google, ÒÁV groups and google code search but couldn't find anything useful. How ÒÁV do you people do this? ÒÁV Thanks a lot! ÒÁV Below is a snippet of my code. Basically, you give the starting row/ ÒÁV col position of the image you want to insert and it goes around adding ÒÁV row/column sizes into imgHeight and imgWidth until their values are ÒÁV equal to or greater than the size of the image. If they're greater, it ÒÁV substracts one row or one column, depending on what was greater, and ÒÁV puts the remaining pixels on dx or dy. ÒÁV protected int addImage(HSSFWorkbook wb, HSSFSheet sheet, InputStream ÒÁV img, int numRow, short numCol) { ÒÁV int x1 = 0; ÒÁV int y1 = 0; ÒÁV short x2 = 0; ÒÁV int y2 = 0; ÒÁV int row1 = numRow; ÒÁV short col1 = numCol; ÒÁV int row2 = numRow; ÒÁV short col2 = numCol; ÒÁV ImageData d = new ImageData(); ÒÁV int idx = loadAndConvertPicture(img,wb,d); ÒÁV int imgHeight = 0; ÒÁV int imgWidth = 0; ÒÁV while(imgWidth d.getWidth() || imgHeight d.getHeight()) { ÒÁV if(imgWidth d.getWidth()) col2++; ÒÁV if(imgHeight d.getHeight()) row2++; ÒÁV if(imgWidth != d.getWidth()) { ÒÁV int colWidth = (int) ÒÁV (sheet.getColumnWidth((short)col2)/48); ÒÁV if(imgWidth+colWidth=d.getAmplada()) { ÒÁV imgWidth +=colWidth; ÒÁV } else { ÒÁV col2--; ÒÁV x2=(short)(d.getWidth()-imgWidth); ÒÁV imgWidth=d.getWidth(); ÒÁV } ÒÁV } ÒÁV if(imgHeight != d.getHeight()) { ÒÁV int rowHeight; ÒÁV HSSFRow row = sheet.getRow(row2); ÒÁV if(row != null) rowHeight = (int) ÒÁV row.getHeight()/20; ÒÁV else rowHeight = (int) ÒÁV sheet.getDefaultRowHeight()/20; ÒÁV if(row == null) row = sheet.createRow(row2); ÒÁV if(imgHeight +rowHeight=d.getHeight()) { ÒÁV imgHeight +=rowHeight; ÒÁV } else { ÒÁV row2--; ÒÁV y2=d.getHeight()-imgHeight ; ÒÁV imgHeight =d.getHeight(); ÒÁV } ÒÁV } ÒÁV } ÒÁV (note: variable and custom method names are translated since I'm not ÒÁV coding this in English; there might be a bug in there somewhere due to ÒÁV this translation. My apologies if this is the case.) ÒÁV - ÒÁV To unsubscribe, e-mail: [EMAIL PROTECTED] ÒÁV Mailing List: http://jakarta.apache.org/site/mail2.html#poi ÒÁV The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: hslf way of getting slideshow text language
h This led me to believe that this atom holds the information I seek. It h is also the only place that language information in mentioned in the h spec. Even if I am wrong, is there any knowledge as to where language h ID for the text runs is held? Right now I am experimenting with h StyleTextPropAtom. I will get back with more info and hopefully more h precise questions. Probably the language info is really stored in TextSpecInfoAtom. Do you have any idea about internal structure of this record? If you do, please share it. Yegor - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: hslf way of getting slideshow text language
4010 is TextSpecInfoAtom. It stores special format runs that can't be described by normal style records. For example, if a part of a string is a hyperlink this info is stored in TextSpecInfoAtom. AFAIK it has nothing to do with the language information. Yegor CG Hi all, CG I am searching for a way to extract language information from .ppt CG documents that corresponds to specific bits of text. Googling up and CG searching both through scratchpad hslf code and file format specs from CG wotsit gave me no useful information. The thing i learned however is CG that it is altogether different from .doc documents, where i have CG successfully carried out this task in the past. Any pointers at all CG would be appreciated. CG In an attempt to be more specific, from my understanding, I need to grab CG record with type 4010, which the code at Sheet.java in method CG findTextRuns() just skips as Safe to ignore. Is this stored and parsed CG somewhere that i missed, or must i do all the parsing myself? In such a CG case, could you please provide me with some pointers as to where to CG begin? CG Thanks in advance for any help. CG Chris Gioran CG - CG To unsubscribe, e-mail: [EMAIL PROTECTED] CG Mailing List: http://jakarta.apache.org/site/mail2.html#poi CG The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: Embedded images
SJ Did you use a as the default character for any reason? Is that a standard SJ assumption to make? It's not documented. Just a guess :) Another variant is '0' but I can't tell for sure. It requires experiments. SJ There seems to be a bug with HSSFSheet.getColumnWidth(). According to the SJ javadocs, it should return the width of a column in units of 1/256 of a char SJ width. This is ok if the column width has already been explicitly set with SJ setColumnWidth(), but if not, it returns the same value as SJ HSSFSheet.getDefaultColumnWidth(), which is measured in characters. So I'm SJ getting the value 8 returned from getColumnWidth() for columns that haven't SJ had their width changed. Is this a known issue? Looks so. Bug 25496 reports on it too. The fix is trivial but it can affect existing code. Any programs that assume getDefaultColumnWidth() returns 8 will be broken. I will look into it on the weekend. Yegor SJ On 07/02/07, Yegor Kozlov [EMAIL PROTECTED] wrote: The problem is that the cell width and height don't seem to be measured in the same units. Exactly. Excel anchores objects against top-left and buttom-right cells. In addition it uses dx and dy for fine positioning relative to these cells. So to get the correct aspect ratio you need to know the number of cells and rows your image will occupy. Here it gets complicated :). The problem is that column width in Excel is expressed in units of 1/256th of a character width of the default font. Conversion from these weird 1/256th units to pixels is not trivial. The minimal steps to calculate width of a cell in pixels are as follows: - get default workbook font. HSSFWorkbook.getFontAt(0) should always return the default one. - get default cell width expressed in 1/256th units. See HSSFSheet.getColumnWidth - Assuming that the default character is a compute the width of a surrogate string using Java2D classes. image.width/cell.width is the number of columns to be used in the anchor. I think this logic needs to be buried into POI API somehow. Probably it will be included in future. Regards, Yegor - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: Embedded images
The problem is that the cell width and height don't seem to be measured in the same units. Exactly. Excel anchores objects against top-left and buttom-right cells. In addition it uses dx and dy for fine positioning relative to these cells. So to get the correct aspect ratio you need to know the number of cells and rows your image will occupy. Here it gets complicated :). The problem is that column width in Excel is expressed in units of 1/256th of a character width of the default font. Conversion from these weird 1/256th units to pixels is not trivial. The minimal steps to calculate width of a cell in pixels are as follows: - get default workbook font. HSSFWorkbook.getFontAt(0) should always return the default one. - get default cell width expressed in 1/256th units. See HSSFSheet.getColumnWidth - Assuming that the default character is a compute the width of a surrogate string using Java2D classes. image.width/cell.width is the number of columns to be used in the anchor. I think this logic needs to be buried into POI API somehow. Probably it will be included in future. Regards, Yegor - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: What is the state of the project?
I doubt if there are any pure Java VBA interpreters. (there can be implementations based on various Java-COM bridges). Creating a VBA interpreter is out of scope of the POI HSSF project but some really useful functionality can be added. I mean to add the following: - read VBA modules using POI. AFAIK, VBA modules are stored as POIFS entries. Did anybody investigate it? - be able to programmatically inject a VBA module in XLS (or modify an existing VBA module). Yegor TM Unfortunately, the ability to invoke a macro may be a requirement. That TM said, does anyone know of another Java-Excel project (e.g. JExcelAPI, TM Pagos spreadsheet component) that does include a VBA interpreter? TM Tom TM PS. On a side note, the POI HSSF project seems to be very easy to use. I TM had a proof of concept up and running in very little time. TM Andrew C. Oliver wrote: No. That would require a VBA interpreter. HSSF is not a spreadsheet engine/app/whatever it is an API to deal with a file format. Tom Muldoon wrote: Andrew, by Macros can be there if ..., do you mean that macros can be invoked / executed from the Java code? The reason that I ask is that the Limitations page states simply ... Macros cannot be created. However, reading and re-writing files containing macros will safely preserve the macros. In other words, it doesn't actually state whether or not macros can be invoked / executed. Thanks again, Tom Andrew C. Oliver wrote: The project is active. We just haven't put out an official release in awhile. Partly because builds/milestones are reasonably stable. Macros can be there if you set the preserve flag off the hssf workbook constructor. Tom Muldoon wrote: I'm wondering what the state of the POI-HSSF project is. I noticed that the latest release is dated 06-Aug-2004 and I'm assuming that this project is no longer active. I also noticed that the archive link is broken. That said, I also noticed in the list of limitations that macros cannot be created, however, I'm wondering if macros can be invoked. Thanks in advance, Tom PS. If this project is no longer active, are there other projects out there that are? - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ TM - TM To unsubscribe, e-mail: [EMAIL PROTECTED] TM Mailing List: http://jakarta.apache.org/site/mail2.html#poi TM The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: spreadsheet with form elements getting corrupt with poi 3.0
Hi, Make sure you are using the latest POI jar. Looks like we fixed similar issue recently. If the problem persists, please create a bug in bugzilla and attache to it the ppt and sample code which produces the error. Regards, Yegor SJ I am generating a spareadsheet by reading off a template excel spreadsheet SJ that has macro's and form elements like buttons, labels etc and then adding SJ data to the spreasdheet with POI. This was working well with POI-2.5.1 but I SJ tried to upgrade to the dev build of POI-3 and the generated spreadsheet SJ gets corrupt and when excel tries to fix it, all the form elements, cell SJ colors etc are missing. SJ Do I have to make any code or other changes with POI 3 for this to work? The SJ reason I want to upgrade to POI 3 is for performance improvements. SJ Thanks, SJ Sanjiv - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: Problem with AutoShape.....
See the tutorial on how to work with shapes in HSLF: http://jakarta.apache.org/poi/hslf/how-to-shapes.html Yegor f8 hi to all... I am new of the forum... f8 I am trying to extract the autoshapes from a slide for then to paint them in f8 a Graphics2D.. f8 the code that I used ... f8 for (int a=0;aVectorAutoShape.size();a++){ f8 java.awt.Rectangle anchor = VectorAutoShape.elementAt(a).getAnchor(); f8 Color color = VectorLine.elementAt(a).getLineColor(); f8 if (color != null){ f8 g2.setColor(color); f8 float width = (float)VectorAutoShape.elementAt(a).getLineWidth(); f8 Stroke stroke = new BasicStroke(width); f8 g2.setStroke(stroke); f8 EscherSpRecord spRecord = f8 VectorAutoShape.elementAt(a).getSpContainer().getChildById(EscherSpRecord.RECORD_ID); f8 boolean flipped = (spRecord.getFlags() f8 EscherSpRecord.FLAG_FLIPVERT) != 0; f8 if (flipped) f8g2.drawLine(anchor.x, anchor.y+anchor.height, f8 anchor.x+anchor.width, anchor.y); f8 else f8g2.drawLine(anchor.x, anchor.y, anchor.x+anchor.width, f8 anchor.y+anchor.height); f8 } f8 } f8 But the bug is this.. f8 Exception in thread main java.lang.ArrayIndexOutOfBoundsException: 1 = 1 f8 at java.util.Vector.elementAt(Unknown Source) f8 at DisegnaComponenti.Disegna(DisegnaComponenti.java:72) f8 at Convert.main(Convert.java:97) f8 What's my error? f8 thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: I am writing an PowerPoint viewer....
Line has enough info to translate ppt commands into Java graphics calls. The sample code is below. public void draw(Graphics2D graphics, Line line){ java.awt.Rectangle anchor = line.getAnchor(); Color color = line.getLineColor(); if (color != null){ graphics.setColor(color); float width = (float)line.getLineWidth(); Stroke stroke = new BasicStroke(width); graphics.setStroke(stroke); EscherSpRecord spRecord = line.getSpContainer().getChildById(EscherSpRecord.RECORD_ID); boolean flipped = (spRecord.getFlags() EscherSpRecord.FLAG_FLIPVERT) != 0; if (flipped) graphics.drawLine(anchor.x, anchor.y+anchor.height, anchor.x+anchor.width, anchor.y); else graphics.drawLine(anchor.x, anchor.y, anchor.x+anchor.width, anchor.y+anchor.height); } } Yegor q hi I am writing an application java that, taken in input a file .ppt, it q allows to display it in a window similar to that used in PowerPoint. Until q now I have developed these points: q - TextBox (I have to resolve a problem on the color of the font there is q no match among the color of PowerPoint and that extracted by the font); q - Image; q I now have a problem with the lines. I have not found a method to q extract the start point and the end point of the line. the information q extracted by the anchor are not enough to be able to redraw the line. q so if someone can help me. thanks to everybody q sorry for my english - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: Master sheet handling
Hi Aha! You are doing it wrong. RichTextRun._getRawParagraphStyle() returns the collection of the OVERRIDDEN style properties. If the properly is not there, you should examine the master sheet. A good example is RichTextRun.getCharTextPropVal(). If a character property is not found it searches it in the master sheet. P.S. I don't recommend you to use the accessors to low-level style records. Be careful, this code is subject to change. Or use it only as a temporary solution, until the proper classes appear. Regards, Yegor EG Hi EG A further explanation: EG I'm working with POI HSLF to read MS-PowerPoint presentations to JAVA objects supplied with POI. EG I have a code that traverses the RichTextRun._getRawParagraphStyle().getTextPropList() list, finding any property with key containing bullet.. This is the way I identify bullets. EG The problem I encounter is that master sheets' bullets are not recognized by HSLF. EG Hope I made myself clearer. EG -Original Message- EG From: Yegor Kozlov [mailto:[EMAIL PROTECTED] EG Sent: б 25 гцобш 2006 14:20 EG To: POI Users List EG Subject: Re: Master sheet handling EG Hi EG Could you describe the problem in details? EG We don't yet support bullets and numbered lists. How did you access EG the bullets info? EG It would be good if you attach the problem to bugzilla. I will take a EG look at it. EG Regards, Yegor EG Hi EG Is it a known problem that master sheets are not parsed well? I see for EG example that bullets from master sheets are not identified, whereas EG bullets specifically requested from the user do. EG Am I correct? If so - is this issue going to be solved soon? EG 10x EG Eitan EG - EG To unsubscribe, e-mail: [EMAIL PROTECTED] EG Mailing List: http://jakarta.apache.org/site/mail2.html#poi EG The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ EG - EG To unsubscribe, e-mail: [EMAIL PROTECTED] EG Mailing List: http://jakarta.apache.org/site/mail2.html#poi EG The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: ArrayIndexOutOfBoundsException in TextRun
Hi Exceptions are not supposed to be thrown. Please post the bug. If possible, attach the ppt file. Regards, Yegor EG Hi EG I have several PPT presentations that cause an EG ArrayIndexOutOfBoundsException to be thrown. EG Before I open a bug in bugzilla, I wanted to know whether this is EG already a known issue, and whether there's an easy workaround. EG Here's a stacktrac: EG java.lang.ArrayIndexOutOfBoundsException - 39 EG at org.apache.poi.util.LittleEndian.getInt(LittleEndian.java:140) EG at EG org.apache.poi.hslf.record.StyleTextPropAtom.setParentTextSize(StyleText EG PropAtom.java:259) EG at org.apache.poi.hslf.model.TextRun.init(TextRun.java:95) EG at org.apache.poi.hslf.model.TextRun.init(TextRun.java:72) EG at org.apache.poi.hslf.model.Sheet.findTextRuns(Sheet.java:136) EG at org.apache.poi.hslf.model.Slide.init(Slide.java:82) EG at EG org.apache.poi.hslf.usermodel.SlideShow.buildSlidesAndNotes(SlideShow.ja EG va:444) EG at EG org.apache.poi.hslf.usermodel.SlideShow.init(SlideShow.java:122) EG 10x, EG Eitan - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: Master sheet handling
Hi Could you describe the problem in details? We don't yet support bullets and numbered lists. How did you access the bullets info? It would be good if you attach the problem to bugzilla. I will take a look at it. Regards, Yegor EG Hi EG Is it a known problem that master sheets are not parsed well? I see for EG example that bullets from master sheets are not identified, whereas EG bullets specifically requested from the user do. EG Am I correct? If so - is this issue going to be solved soon? EG 10x EG Eitan - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: [HSLF] Bug 40143 - Font size
Hi We remember about this bug. I did some investigation into it but as usual, was diverted by other tasks :). After Christmas I will have a week to review HSLF code and fix this bug. Thank you for reminding us. Yegor TPN Hi List, TPN any news about bug #40143 TPN http://issues.apache.org/bugzilla/show_bug.cgi?id=40143? I'm TPN experiencing the same problem described in some files. The font size TPN returned is wrong, sometimes the correct information is being stored in TPN other style like asian_or_complex, char_unknown_2 and even font.color. TPN This is really annoying. TPN Thanks! TPN -- TPN Tales Paiva TPN - TPN To unsubscribe, e-mail: [EMAIL PROTECTED] TPN Mailing List: http://jakarta.apache.org/site/mail2.html#poi TPN The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: CorruptPowerPointFileException
Hi We are investigating this problem. See http://issues.apache.org/bugzilla/show_bug.cgi?id=41176 You can attach the file to this bug. Do you know what software was used to produce this file? PowerPoint or OpenOffice or whatever else? Anything special about this file? Yegor EG Hi EG I get the following exception, trying to instantiate a SlideShow with a specific PPT file, I get: EG org.apache.poi.hslf.exceptions.CorruptPowerPointFileException: The PowerPoint file had a broken first SlideListWithTexts. This should only contain either MainMasters, or Slides, but it contained EG a mix of both (1 slides and 1 masters) EG at org.apache.poi.hslf.usermodel.SlideShow.buildSlidesAndNotes(SlideShow.java:352) EG at org.apache.poi.hslf.usermodel.SlideShow.init(SlideShow.java:121) EG (I couldn't send the file as the mailer-daemon doesn't allow me). EG When I roll-back to the version I had previously (also attaced) - there's no problem. EG Any idea why? EG 10x EG EG Eitan Gur EG RD EG AxisMobile Ltd. EG Consumer Mobile Email EG Tel: Int +972-3-768 5538 EG Mobile: Int +972-54-3105142 EG Fax: Int +972-3-768 5556 EG [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] EG - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: POI, Excel, charset 1251
Use unicode. http://jakarta.apache.org/poi/faq.html#faq-N100A4 FAQ #11. Regards, Yegor IS hi ! IS my Java program create Excel file where i tried fill in cell by Cp1251 (rus/cyrilic) string charcode IS but in Excel app this strings looks like this : !#253;#253;#253;#253;#253;#253;#253;#253;#253;#253; IS charset of java source file is Cp1251; IS java source compile with default charset (Cp1251) without any warning; IS Cp1251 strings in my java source looks good; IS Excel 2003 IS java ver. = 1.6 IS POI-2.5.1 IS ... IS in Exl result file my Cp1251 strings broke (unreadeble looks) IS :( IS could you please help me ? IS thanks, IS ivan s. IS - IS To unsubscribe, e-mail: [EMAIL PROTECTED] IS Mailing List: http://jakarta.apache.org/site/mail2.html#poi IS The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: PPT Unicode
Hi, Could you provide a test case? As I understood you did something like this: - take a ppt file with a text. - programmatically change the text using HSLF API - save file - style information is wrong after save. Is it correct? Yegor TPN Hi List, TPN When PowerPoint stores text in Unicode a unknown char (byte value = TPN 0) is placed between every normal char making the text 2 times longer TPN than it really is. I can ignore these garbage chars, but I lost the text TPN style informations, as it's indexes are based in the original unicode TPN text with all that unicode trash. :( TPN Is there any way to keep the style information and get the text as a TPN TextByteAtom, instead of TextCharsAtom? TPN Thank you very much. TPN -- TPN Tales Paiva TPN - TPN To unsubscribe, e-mail: [EMAIL PROTECTED] TPN Mailing List: http://jakarta.apache.org/site/mail2.html#poi TPN The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: error with getSlideNumber()
Hi, Make sure you are using the latest POI jar. We fixed this bug some time ago. Daily builds are available at http://encore.torchbox.com/poi-cvs-build/. If the problem persists, could you create an issue in bugzilla and attach your test ppt? Regards, Yegor DPN org.apache.poi.hslf.model.Slide.getSlideNumber() will not work correctly if we reorder the slides, the same bug happens for org.apache.poi.hslf.usermodel.SlideShow.getSlides(), the return DPN Slide[] array is also in the old order. DPN How to reproduce the error: DPN 1. Create an presentation with PowerPoint or OpenOffice, with,say 10 slides. Add some Notes on each slides. Save as a.ppt DPN 2. Copy the a.ppt to b.ppt, reorder the slides, for examples: drag slide number 2 to the 8th slide; change slide 3 to position 5th. Save b.ppt DPN 3. Try to print the Notes from Slide Nr 1-Slide Nr 10. In both case of a.ppt, b.ppt, the result will be the same even though the text (of Notes) order in a.ppt and b.ppt are different. DPN - DPN To unsubscribe, e-mail: [EMAIL PROTECTED] DPN Mailing List: http://jakarta.apache.org/site/mail2.html#poi DPN The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: (POI/PPT) NullPointerException - EscherTextboxWrapper
Should I open a new bug in bugzilla? Yes, I would like to look at it. NB Yegor - any thoughts on if it's our fault that Shape.getEscherChild is NB returning null, or if it's a nasty powerpoint feature we need to NB work around? Could it be a text box without text records, i.e EscherTextboxRecord is missing ? Theoretically it is possible to have it, for example, if you don't put text in a placeholder. - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: documentation - POI - PPT
Hi, PPT file format is not documented. What we learn about it we put in the following doc: http://jakarta.apache.org/poi/hslf/ppt-file-format.html It's far from complete, as always other tasks have higher priority then documenting :). Some time ago MSDN (prior to 1998) contained partial docs about the ppt format but later they excluded it. What features you are interested in? Regards, Yegor EE Hi EE Where can I find documentation about all the features and the support EE for PPT files? EE thanks EE - EE To unsubscribe, e-mail: [EMAIL PROTECTED] EE Mailing List: http://jakarta.apache.org/site/mail2.html#poi EE The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: creating a table in PPT using POI -HSLF
Hi Currently tables are not supported by HSLF. You are right, a table in PowerPoint is a group of rectangles and lines plus some special info about rows/columns. We know how PowerPoint stores this information, just need time to implement. Regards, Yegor pb Hi, pb Is it possible to create a table in PPT using POI API pb and add textbox to it?. or do i need to use pb shapeObjects such as rectangle and lines only in place pb of table, which may not look too good for ppt edit pb outside of POI. pb please let me know if possible how? pb Thanks, pb prashanth pb __ pb Do You Yahoo!? pb Tired of spam? Yahoo! Mail has the best spam protection around pb http://mail.yahoo.com pb - pb To unsubscribe, e-mail: [EMAIL PROTECTED] pb Mailing List: http://jakarta.apache.org/site/mail2.html#poi pb The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: Problem Getting Grouped Images
Hi, Groupped image is just a shape inside another shape. Image extraction should work fine for it. Can you attach the ppt file? It's the easiest way to see what's wrong. Regards, Yegor G Hi POI Users, G I'm extracting images from a powerpoint file, but when I group the images G and try to extract, I get a java.lang.NullPointerException at G hslf.model.Picture.getPictureData(+4) . Does anyone have any clue of where G do I go to get anything about Grouped Images? G Thnx, G Gerson Albuquerque - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: org.apache.poi.hslf.model.ShapeGroup - getShapes()
What shapes do you have in the slide? Text boxes, rectangles or something more complex, for example, polygons or custom shapes? NB On Tue, 26 Sep 2006, Erez Eisenstein wrote: class java.lang.ClassCastException - org.apache.poi.ddf.EscherOptRecord java.lang.ClassCastException: org.apache.poi.ddf.EscherOptRecord at org.apache.poi.hslf.model.ShapeGroup.getShapes(ShapeGroup.java:59) NB Looks like we were just expecting the shape to be made up of NB EscherContainerRecords, but they aren't always. NB I've applied a fix, but it would be good if you could upload the NB powerpoint file to bugzilla. That way, we'll have something to test my fix NB against, and make sure it's still sane NB Nick NB - NB To unsubscribe, e-mail: [EMAIL PROTECTED] NB Mailing List: http://jakarta.apache.org/site/mail2.html#poi NB The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: AW: Reading numeric values as strings from a cell
Hi, For numerical cells the code is like this: HSSFWorkbook wb = ...; HSSFDataFormat dataformat = wb.createDataFormat(); double value = cell.getNumericCellValue(); //get the cell value HSSFCellStyle style = cell.getCellStyle(); short idx = style.getDataFormat(); //get format pattern for this cell String format = dataformat.getFormat(idx); //try to create java formatter. Warning: This MAY not work in all cases! NumberFormat fmt = new DecimalFormat(format); String fmtvalue = fmt.format(value); //compare it with what you have in Excel. Regards, Yegor - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: slide 2 image
Look at http://tonicsystems.com/. The claim their Java API can render slides into JPEG or PDF. SG Hi, SG I'm very new to poi. I'm looking for any code snippet, documentation SG of hint how to render a slide to a image. SG Can anyone give a hint? SG Thank you very much! SG Stefan SG - SG To unsubscribe, e-mail: [EMAIL PROTECTED] SG Mailing List: http://jakarta.apache.org/site/mail2.html#poi SG The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: hslf textbox alignment
Hi, CdM Is there a way to do horizontal alignment in a CdM org.apache.poi.hslf.model.TextBox? I want to center the text inside the textbox CdM horizontally but I only found a method setVerticalAlignment. It looks like the get/set methods for horizontal alignment are missing. It's not hard to add this functionality. You can expect this patch in the nearest future. Regards, Yegor - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: [HSLF] Indentation level identification
Hi, TPN Is there any other way to identify the indentation level for a given TPN RichTextRun? Unfortunately you can't retrieve the indentation level for a RichTextRun. It's not supported by the current code. Indentation level is stored as a 2-byte paragraph property in the style record. Initially we thought that this value is 'safe to ignore', it was always 0 in out test ppt files. In fact it stores the indentation level and can be a number in the range 0-4 (there can be up to 5 indent levels in PowerPoint). I'm not sure if it is an easy fix and I'd like to hear Nick's opinion. Regards, Yegor TPN Hi, TPN I need to identify the indentation level of a text in a TextBox. For this TPN I created a method in the RichTextRun class as follows: TPN public int getTextOffset(){ TPN return getParaTextPropVal(text.offset); TPN } TPN Assuming that the property name that holds this information is TPN text.offset, is it? TPN When I call it from my main class, it returns -1. I know this is because TPN the RichTextRun inherits the property from the Master. TPN Thanks a lot, TPN Tales Paiva TPN - TPN To unsubscribe, e-mail: [EMAIL PROTECTED] TPN Mailing List: http://jakarta.apache.org/site/mail2.html#poi TPN The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: [HSLF] Indentation level identification
Nick, In StyleTextPropAtom.setParentTextSize when we read paragraph properties we ignore the 2-byte value before the paragraph properties: // Fetch the 2 byte value that is safe to ignore as 0 short paraIgn = LittleEndian.getShort(rawContents,pos); pos += 2; In fact it stores the indentation level. What is bad, that this value is re-setted to 0 when a slide show is saved and the indentation information is lost. Try to re-save a ppt with indents and see that they are lost! I'm not sure I can quickly fix it, have a busy time last days :). If you can - do please. Regards, Yegor YK Hi, TPN Is there any other way to identify the indentation level for a given TPN RichTextRun? YK Unfortunately you can't retrieve the indentation level for a YK RichTextRun. It's not supported by the current code. YK Indentation level is stored as a 2-byte paragraph property in the YK style record. Initially we thought that this value is 'safe to YK ignore', it was always 0 in out test ppt files. In fact it stores the YK indentation level and can be a number in the range 0-4 (there can be YK up to 5 indent levels in PowerPoint). YK I'm not sure if it is an easy fix and I'd like to hear Nick's opinion. YK Regards, Yegor TPN Hi, TPN I need to identify the indentation level of a text in a TextBox. For this TPN I created a method in the RichTextRun class as follows: TPN public int getTextOffset(){ TPN return getParaTextPropVal(text.offset); TPN } TPN Assuming that the property name that holds this information is TPN text.offset, is it? TPN When I call it from my main class, it returns -1. I know this is because TPN the RichTextRun inherits the property from the Master. TPN Thanks a lot, TPN Tales Paiva TPN - TPN To unsubscribe, e-mail: [EMAIL PROTECTED] TPN Mailing List: http://jakarta.apache.org/site/mail2.html#poi TPN The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ YK - YK To unsubscribe, e-mail: [EMAIL PROTECTED] YK Mailing List: http://jakarta.apache.org/site/mail2.html#poi YK The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: RES: Extracting Tables from PowerPoint
If you need the text in cells use TextRun.getText(). Does it return the correct text? TextRun.getRichTextRuns() is supposed to return an array of runs of text with the same styling. The size of the array of RichTextRuns should be greater than 0. Could you attach your ppt file and we will look at it? Yegor G Hi, G Using your example below, I was able to identify the number of cells G correctly, but the text is not coming, when I ask the length of the array of G RichTextRuns from the text boxes, it returns 0 (Zero). G Do you know why this can be happening, and a possible solution? G Thnx again, G Gerson Albuquerque G -Mensagem original- G De: Yegor Kozlov [mailto:[EMAIL PROTECTED] G Enviada em: segunda-feira, 14 de agosto de 2006 11:26 G Para: POI Users List G Assunto: Re: Extracting Tables from PowerPoint G Hi, G A table in PowerPoint is a group of shapes. G It HSLF API it is represented by a org.apache.poi.hslf.model.ShapeGroup G class. G Typically a table consists of TextBox and Line objects which represent G text runs and borders. G Below is sample code how to iterate over table cells: G Slide slide = ...; G Shape[] sh = slide.getShapes(); G for (int i = 0; i sh.length; i++) { Gif (sh[i] instanceof ShapeGroup){ //got a table G ShapeGroup table = (ShapeGroup)sh[i]; G Shape[] ch = table.getShapes(); G for (int j=0; jch.length; j++){ Gif (ch[j] instanceof TextBox){ G TextBox txt = (TextBox)ch[j]; G String text = txt.getText(); //text in a table cell G} G } G} G } G Creating new tables is not yet supported. It's clear how to implement G it, just need time. G Regards, Yegor G Hi, G I´ve searched but havent found anything. Can anybody help me on how to G extract Tables from PPT using POI. G Thnx, G Gerson Albuquerque G - G To unsubscribe, e-mail: [EMAIL PROTECTED] G Mailing List: http://jakarta.apache.org/site/mail2.html#poi G The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ G ___ G Você quer respostas para suas perguntas? Ou você sabe muito e quer compartilhar seu conhecimento? Experimente o Yahoo! Respostas ! G http://br.answers.yahoo.com/ G - G To unsubscribe, e-mail: [EMAIL PROTECTED] G Mailing List: http://jakarta.apache.org/site/mail2.html#poi G The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: Extracting Tables from PowerPoint
Hi, A table in PowerPoint is a group of shapes. It HSLF API it is represented by a org.apache.poi.hslf.model.ShapeGroup class. Typically a table consists of TextBox and Line objects which represent text runs and borders. Below is sample code how to iterate over table cells: Slide slide = ...; Shape[] sh = slide.getShapes(); for (int i = 0; i sh.length; i++) { if (sh[i] instanceof ShapeGroup){ //got a table ShapeGroup table = (ShapeGroup)sh[i]; Shape[] ch = table.getShapes(); for (int j=0; jch.length; j++){ if (ch[j] instanceof TextBox){ TextBox txt = (TextBox)ch[j]; String text = txt.getText(); //text in a table cell } } } } Creating new tables is not yet supported. It's clear how to implement it, just need time. Regards, Yegor G Hi, G I´ve searched but havent found anything. Can anybody help me on how to G extract Tables from PPT using POI. G Thnx, G Gerson Albuquerque - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: Get text from a URL pointing to a ppt file
Hi, I think it can be caching issue. I guess your code was something like this: URL url = new URL(http://localhost:8080/analysis.ppt;); URLConnection conn = url.openConnection(); InputStream is = conn.getInputStream(); SlideShow ppt = new SlideShow(is); //the order of slides is incorrect I would try to call conn.setUseCaches(false) before opening the input stream: URL url = new URL(http://localhost:8080/analysis.ppt;); URLConnection conn = url.openConnection(); conn.setUseCaches(false); InputStream is = conn.getInputStream(); SlideShow ppt = new SlideShow(is); //Does it fix the problem? Regards, Yegor LH Hello, LH I am trying to use SlideShow.getSlides() to get slides from a URL pointing LH to a powerpoint file. The problem is that I am not getting the LH slides in the correct order. However, if I download the ppt file and run LH the same program, The order of the slides is much closer to the real LH order, i.e. at least I get the first few slides in order (and this is LH what I need). Any idea how I can fix the problem? LH Thanks, LH Leila LH - LH To unsubscribe, e-mail: [EMAIL PROTECTED] LH Mailing List: http://jakarta.apache.org/site/mail2.html#poi LH The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: non {png,jpg} images
Hi, Supported image formats in PPT are: EMF, WMF, PICT, JPEG, PNG and DIB. If you insert pictures in other formats PPT may convert them, for example, into JPEG or PNG and store the converted data. I confirmed that on Windows BMP is converted into PNG. Could you send your PPT with TIFF? I would like to examine it. PNG and JPEG images are organized in a similar way: 25 byte header + raw image data. Probably this rule breaks for other formats. Probably there are some features with ppts created on MAC. You never know it with PowerPoint :) Regards, Yegor - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: HSLF: Adding notes to a slide
si Just wanted to double check, does add new text refer to notes? Yes, it refers to notes. We can add/edit text in shapes. It's clear how to implement notes, just need time to do it :). - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: TextBox bug
I will look into it when have my hands free :)) NB On Thu, 13 Jul 2006, Tales Paiva Nogueira wrote: This piece of code doesn't work in all cases, I made some tests and the NullPointerException still happens. NB I wonder if in this case, it's a TextBox that doesn't actually have any NB text in it. I leave it for Yegor to confirm or deny though, since he knows NB the most about TextBoxes :) NB Nick NB - NB To unsubscribe, e-mail: [EMAIL PROTECTED] NB Mailing List: http://jakarta.apache.org/site/mail2.html#poi NB The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: PPT Pictures
There are two ways to retrieve images from a ppt file: 1. Use HSLFSlideShow.getPictureData(). This method always returns the content of the image stream, It doesn't know if the images are used in the slides or not. I would say it corresponds to physical level, not to the logical, i.e. it returns images that are stored in the ppt file, not the ones that are actually used. As Nick says, if you edit your ppt with 'incremental save' option enabled, HSLFSlideShow.getPictureData() can return previously deleted images which will be gone on next full resave. 2. Iterate over the shapes in a slide and collect Picture shapes. This approach guarantees that you get only those Pictures that are actually used: Slide[] slide = ppt.getSlides(); for (int i = 0; i slide.length; i++) { Slide sl = slide[i]; Shape[] sh = sl.getShapes(); for (int j = 0; j sh.length; j++) { Shape shape = sh[j]; if (shape instanceof Picture){ Picture picture = (Picture)shape; PictureData pict = picture.getPictureData(); byte[] data = pict.getData(); int type = pict.getType(); if (type == Picture.JPEG){ FileOutputStream out = new FileOutputStream(_slide+j+.jpg); out.write(data); out.close(); } else if (type == Picture.PNG){ FileOutputStream out = new FileOutputStream(_slide+j+.png); out.write(data); out.close(); } } } } Yegor mj Hi mj I'd like to report an error that i found while using POI. I was retrieving mj the pictures from a ppt file and saving each one in a file and it was mj working ok, but i deleted one of the pictures of the PowerPoint file and POI mj was still saving it in a file. Then I realized that it happens when the mj source file of the picture is NOT a .PNG file. In this case, it happened mj with a .BMP and a .JPG file. mj Any suggestions? mj Thanks, mj mr_jonze. mj 2006/7/3, Yegor Kozlov [EMAIL PROTECTED]: Hi For instance, if there are 3 pictures, being 2 of them the same picture, the returned vector length is 2. It's how it is supposed to work. HSLFSlideShow.getPictures() returns the actual array of images contained in the presentation. Each image is included only once regardless of how many times you have it in the slides. What can I do to get the real images number? It looks like you need the number of images shapes, not the number of actual images contained in the ppt. See the code: SlideShow ppt = new SlideShow(new HSLFSlideShow(images.ppt)); //images contained in this slide show PictureData[] pict = ppt.getPictureData(); //get the number of image shapes int imageCount = 0; Slide[] slide = ppt.getSlides(); for (int i = 0; i slide.length; i++) { Shape[] sh = slide[i].getShapes(); for (int j = 0; j sh.length; j++) { if (sh[j] instanceof Picture) { Picture p = (Picture)sh[j]; PictureData pdata = p.getPictureData(); imageCount++; } } } Since the same image can be placed on several slides imageCount may not equal to pict.length. Yegor - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: POI issue
Hi, Your code is almost correct. The last lines must be as follows: FileOutputStream out = new FileOutputStream(C:/Test/Presen.ppt); ppt.write(out); out.close(); I.e. To create a new PPT you call SlideShow ppt = new SlideShow(); To write it to a output stream call ppt.write(out); HSSFWorkbook has nothing to do with the PPT stuff. It's about XLS generation. Regards, Yegor K Hi, K I am new to POI. I am trying out the sample examples that were given in POI K site. K I am getting the following error while opening the ppt file generated,just K after executing the following program. Can anyone tell me what might be the K problem was? K Thanks in advance. K Error:PowerPoint cant open the type of file represented by C:\Test\Presen.ppt K And the java file is : K public class PPTExample { K public static void main(String ar[]){ K try{ K SlideShow ppt = new SlideShow(); K HSSFWorkbook wb = new HSSFWorkbook(); K Slide slide = ppt.createSlide(); K //Line shape K Line line = new Line(); K line.setAnchor(new java.awt.Rectangle(50, 50, 100, 20)); K line.setLineColor(new Color(0, 128, 0)); K line.setLineStyle(Line.LineDashDotSys); K slide.addShape(line); K //TextBox K TextBox txt = new TextBox(); K txt.setText(Hello, World!); K txt.setAnchor(new java.awt.Rectangle(100, 100, 200, 50)); K txt.setFontSize(32); K txt.setFontName(Arial); K txt.setBold(true); K slide.addShape(txt); K //Autoshape K //32-point star K AutoShape sh1 = new AutoShape(ShapeTypes.Star32); K sh1.setAnchor(new java.awt.Rectangle(50, 50, 100, 200)); K sh1.setFillColor(Color.red); K slide.addShape(sh1); K //Trapezoid K AutoShape sh2 = new AutoShape(ShapeTypes.Trapezoid); K sh2.setAnchor(new java.awt.Rectangle(150, 150, 100, 200)); K sh2.setFillColor(Color.blue); K slide.addShape(sh2); K FileOutputStream out = new FileOutputStream(C:/Test/Presen.ppt); K wb.write(out); K out.close(); K }catch(Exception e){ K System.out.println(Exception = +e); K } K } K } K - K To unsubscribe, e-mail: [EMAIL PROTECTED] K Mailing List: http://jakarta.apache.org/site/mail2.html#poi K The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: PPT Pictures
Hi Attach the bad ppt and we will see what is wrong. Also I would like to see the code which saves ppt images. Yegor mj Hi mj I'd like to report an error that i found while using POI. I was retrieving mj the pictures from a ppt file and saving each one in a file and it was mj working ok, but i deleted one of the pictures of the PowerPoint file and POI mj was still saving it in a file. Then I realized that it happens when the mj source file of the picture is NOT a .PNG file. In this case, it happened mj with a .BMP and a .JPG file. mj Any suggestions? mj Thanks, mj mr_jonze. mj 2006/7/3, Yegor Kozlov [EMAIL PROTECTED]: Hi For instance, if there are 3 pictures, being 2 of them the same picture, the returned vector length is 2. It's how it is supposed to work. HSLFSlideShow.getPictures() returns the actual array of images contained in the presentation. Each image is included only once regardless of how many times you have it in the slides. What can I do to get the real images number? It looks like you need the number of images shapes, not the number of actual images contained in the ppt. See the code: SlideShow ppt = new SlideShow(new HSLFSlideShow(images.ppt)); //images contained in this slide show PictureData[] pict = ppt.getPictureData(); //get the number of image shapes int imageCount = 0; Slide[] slide = ppt.getSlides(); for (int i = 0; i slide.length; i++) { Shape[] sh = slide[i].getShapes(); for (int j = 0; j sh.length; j++) { if (sh[j] instanceof Picture) { Picture p = (Picture)sh[j]; PictureData pdata = p.getPictureData(); imageCount++; } } } Since the same image can be placed on several slides imageCount may not equal to pict.length. Yegor - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: PPT Pictures
Hi For instance, if there are 3 pictures, being 2 of them the same picture, the returned vector length is 2. It's how it is supposed to work. HSLFSlideShow.getPictures() returns the actual array of images contained in the presentation. Each image is included only once regardless of how many times you have it in the slides. What can I do to get the real images number? It looks like you need the number of images shapes, not the number of actual images contained in the ppt. See the code: SlideShow ppt = new SlideShow(new HSLFSlideShow(images.ppt)); //images contained in this slide show PictureData[] pict = ppt.getPictureData(); //get the number of image shapes int imageCount = 0; Slide[] slide = ppt.getSlides(); for (int i = 0; i slide.length; i++) { Shape[] sh = slide[i].getShapes(); for (int j = 0; j sh.length; j++) { if (sh[j] instanceof Picture) { Picture p = (Picture)sh[j]; PictureData pdata = p.getPictureData(); imageCount++; } } } Since the same image can be placed on several slides imageCount may not equal to pict.length. Yegor - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: Position and size
There is a Shape.getAnchor() which returns anchor of the shape. see the example: SlideShow ppt = new SlideShow(new HSLFSlideShow(filename)); Slide sl = ppt.getSlides()[0]; Shape[] sh = sl.getShapes(); for (int i = 0; i sh.length; i++) { //anchor of the shape java.awt.Rectangle anchor = sh[i].getAnchor(); } Some documentation is available at http://jakarta.apache.org/poi/hslf/how-to-shapes.html Yegor SP How to do to capture the position and size of the boxes of text of an SP archive .ppt? SP Thanks! SP Saulo Passos SP (Developer) - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: org.apache.poi.hslf.model.TextRun
Hi TextRun is just a holder of the text. If you want to work with shapes you should use Slide.getShapes() which returns a collection of shapes in the slide: SlideShow ppt = new SlideShow(new HSLFSlideShow(filename)); Dimension pgsize = ppt.getPageSize(); //page size Slide sl = ppt.getSlides()[0]; Shape[] sh = sl.getShapes(); for (int i = 0; i sh.length; i++) { //anchor of the shape java.awt.Rectangle anchor = sh[i].getAnchor(); if (sh[i] instanceof TextBox){ TextBox box = (TextBox) String text = box.getText(); String font = box.getFontName(); int size = box.getFontSize(); ... } } Warning: In the current implementation you can get text attributes only if they are explicitly set. For example, if you don't change the default font size box.getFontSize() return -1 which means n/a. In this case PowerPoint uses the default font size which is stored in special container TxMasterStyleAtom which is not decoded yet. Also the object model for working with character/paragraph attributes is likely to change. Current code is rather demonstration of capabilities, not the final version. Some documentation is available at http://jakarta.apache.org/poi/hslf/how-to-shapes.html Regards, Yegor EE I am asking about the TextRun[] return from the method EE org.apache.poi.hslf.model.Slide.getTextRuns(). EE For each TextRun, I want to know its x/y position. EE -Original Message- EE From: Nick Burch [mailto:[EMAIL PROTECTED] EE Sent: Wednesday, June 07, 2006 5:05 PM EE To: Erez Eisenstein EE Cc: POI Users List EE Subject: Re: org.apache.poi.hslf.model.TextRun EE Please always use the lists for asking POI questions. EE On Wed, 7 Jun 2006, Erez Eisenstein wrote: How can I get the position (x,y coordinates) of a TextRun in the EE slide? EE That depends on what kind of text run it is. If it's text positioned EE acording to the master slide, then because we don't currently grok the EE master slides, that information isn't available. EE If it's a text run stored in an Escher object (EscherTextboxWrapper), EE you EE can get some information on the object's position from the parent Escher EE objects. EE Nick EE - EE To unsubscribe, e-mail: [EMAIL PROTECTED] EE Mailing List: http://jakarta.apache.org/site/mail2.html#poi EE The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: org.apache.poi.hslf.model.Slide
The number of the first slide is stored in DocumentAtom. In PowerPoint you can change it in the Page Setup dialog. If we get slides in the correct order then getSlideNumber should return DocumentAtom.firstSlideNumber + idx; where idx is 0-based index in the array of slides. You can play with this setting and see how slides are numbered in a ppt. I'm not 100% sure this rule always works. I wonder if it is possible to have gaps in numeration. Did you ever see such ppt? Regards, Yegor NB Firstly, please use poi-user for questions like this. NB On Mon, 5 Jun 2006, Erez Eisenstein wrote: I wanted to know if there is a way to fix the result getting from getSlideNumber method of class Slide. (since the number I'm getting is not the slide number in the slideshow order) NB Alas no. We haven't figured out where powerpoint stores the slide number, NB and we're starting to suspect that it doesn't actually store it as such NB Assuming Yegor's ideas on the slide ordering (see bug #39547) do hold true NB when we test them on lots of files, then that code may help NB Nick NB - NB To unsubscribe, e-mail: [EMAIL PROTECTED] NB Mailing List: http://jakarta.apache.org/site/mail2.html#poi NB The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: HSLF - problem getting correct style of richTextRuns
Hi In HSLF we only have initial support for rich text runs. You can read style attributes only if they are explicitly set. If style is not set explicitly it is taken from a special container TxMasterStyleAtom which is not implemented yet. I think I know how to handle master character styles. This is in my TODO list. Paragraph styles are more tricky. PPT inserts a special symbols in the text like 0x0B to mark the beginning of each paragraph. There is a ruler record which defines indentation of each level but I didn't decode it yet. MSDN says Special parsing code is needed to parse content of this atom so I have to guess and it takes time. Regards, Yegor KR Hi, KR I'm using the HSLF, and I noticed the following problems: KR 1. If I have a slide, In which I just printed some lines in the KR default styling (I didn't manually set the size or font of the KR characters), then I get -1 and null when using KR richTextRun.getFontSize() and richTextRun.getFontName() . KR When creating the presentation - if I press enter in order to start a KR new line (with a bullet) and press tab and write (in this case the font KR size is getting smaller by default), I still get no difference in the KR fonts sizes. KR It looks like this: KR * First line - real size 32 (shows size -1 or the last font size KR I set) KR * Second line - real size 32 (shows size -1 or the last font KR size I set) KR oThird line - real size 24 (shows size -1 or the last font size KR I set) KR Is this a bug or can I get this information in another way? KR 2. I can't see in any way that text begins with one tab right. Is KR there a way to get this information? KR Please help me with the above problems. KR Thanks, KR Karajo. - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: Is PPT Merging possible with HSLF
Hi Poornima, OK, since you want it right now here it is: //source ppt String srcppt; //path to the source presentation SlideShow src = new SlideShow(new HSLFSlideShow(srcppt)); //target ppt to copy slides to. // In this example it is a new ppt but you can add slides to existing one. SlideShow tgt = new SlideShow(); Slide[] sl = src.getSlides(); //get slides for (int i = 0; i sl.length; i++) { Slide slide = tgt.createSlide(); //create a slide to copy shapes to //copy shapes from the source ppt Shape[] sh = sl[i].getShapes(); for (int j = 0; j sh.length; j++) { slide.addShape(sh[j]); } } OutputStream out = new FileOutputStream(merged.ppt); tgt.write(out); out.close(); This code is new, it was commited a month ago and most likely there are bugs. Text formatting may not be preserved fully. Complex shapes like tables may not work. The example above is just a demonstration of capabilities (a technology preview). There are lots of undone stuff. Let me know if you have problems with a particular type of shape. Regards, Yegor Kozlov PA Thanks Yegor, PA Could i get the example you were talking ablout? PA Thanks a lot, PA Poornima PA On 4/6/06, Yegor Kozlov [EMAIL PROTECTED] wrote: Hi No, you can't do it for now. HSLF is young and evolving project and the described functionality is not implemented yet. HSLF already knows how to get list of slides for a PPT, read shapes contained within a particular slide and read/edit/add a limited set of shape's properties. Actually it is what I've been implementing last months. Copying of simple shapes (TextBox, Line, etc) to another PPT seems not difficult to me. I can't give you an example right now but if everything is OK a demo can be expected in a month or so. It won't work if your source PPTs contain complex shapes (Tables or custom curves which are described by an arbitrary set of points). These guys are in my TODO list but my hands are always full and I can't say how soon I will proceed to them. Regards, Yegor Kozlov PA Hi, PA I need to merge two or more ppts to a new ppt. I also need to add my own PA slides at the top and bottom of the merged PPT. All the formatting, color, PA layout of both the PPT should be retained. PA Please let me now if this is possible with HSLF. Any pointers would be PA greatly appreciated. PA Thanks, PA Poornima - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: Is PPT Merging possible with HSLF
Hi No, you can't do it for now. HSLF is young and evolving project and the described functionality is not implemented yet. HSLF already knows how to get list of slides for a PPT, read shapes contained within a particular slide and read/edit/add a limited set of shape's properties. Actually it is what I've been implementing last months. Copying of simple shapes (TextBox, Line, etc) to another PPT seems not difficult to me. I can't give you an example right now but if everything is OK a demo can be expected in a month or so. It won't work if your source PPTs contain complex shapes (Tables or custom curves which are described by an arbitrary set of points). These guys are in my TODO list but my hands are always full and I can't say how soon I will proceed to them. Regards, Yegor Kozlov PA Hi, PA I need to merge two or more ppts to a new ppt. I also need to add my own PA slides at the top and bottom of the merged PPT. All the formatting, color, PA layout of both the PPT should be retained. PA Please let me now if this is possible with HSLF. Any pointers would be PA greatly appreciated. PA Thanks, PA Poornima - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: problem with HSLF slides and RichTextRuns
3. I would like to know what pictures belong to what slide. Is it possible? (I didn't find a way to do it) if not, when will this be possible? NB I don't believe it is currently possible. It should be fairly easy to NB implement, once we know how powerpoint matches pictures to slides. Until NB we know that, we can't code the functionality! NB Nick Hi Nick, it is possible! This functionality new. I added it just a couple of weeks ago. Below is an example how to know what pictures belong to what slide: SlideShow ppt = new SlideShow(new HSLFSlideShow(filename));//source ppt //array of picture data contained in the presentation. //it has global scope since the same picture can be included in multiple slides PictureData[] pict = ppt.getPictures(); Slide[] slide = ppt.getSlides(); for (int i = 0; i slide.length; i++) { Slide sl = slide[i]; Shape[] sh = sl.getShapes(); //get all shapes for this slide for (int j = 0; j sh.length; j++) { Shape shape = sh[j]; if (shape instanceof Picture){ Picture picture = (Picture)shape; //i-based index of the actual picture data int idx = picture.getPictureIndex(); PictureData pictdata = pict[idx-1]; //raw data. byte[] data = pictdata.getData(); BufferedImage img = ImageIO.read(new ByteArrayInputStream(data)); //draw image of save it to a file or do whatever you want. } } } } Note, current implementation supports only JPEG and PNG formats. WMF and Macintosh PICT are not yet supported. Regards, Yegor Kozlov - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: ayuda, para ver power point!!
No, you can't do that. I'm not sure this functionality will ever present in HSLF. First of all, HSLF is meant for reading/writing ppt files, i.e. you can extract information about shapes, texts and other objects from a ppt file or you can create such ppt files on the fly. In future, I can imagine an utility based on HSLF which will build screen captures of PPT slides and save them as images. Regards, Yegor Kozlov l Greetings. I do not speak ingles. use translator. I want that my l window java(JFrame) shows a file to power point. It is possible to do l this using POI-HSLF. Thanks for its aid l In spanish: l Saludos. no hablo ingles. uso traductor. l Quiero que mi ventana java(JFrame) muestre un archivo power point. Es l posible hacer esto usando POI-HSLF?. l Gracias por su ayuda. l -- l Ing. Jaime Vargas Pereyra lPiura - Perú l - l To unsubscribe, e-mail: [EMAIL PROTECTED] l Mailing List: http://jakarta.apache.org/site/mail2.html#poi l The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: Powerpoint and HSLF
Hi Nick NB Yegor - YA adding slides fix: alas the RefId wasn't as simple as NB (slide ID+2), it's actually the sheet ID from the PersistPtr NB stuff. I've fixed the code, and added some more tests to NB TestSlides to check it all Thank you. I'm going to do stress testing tonight. In my development I always create new PPTs from scratch and the rule (slide ID+2) always works. Now I see where I'm wrong. Yegor - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: Image extraction
Hi I think I know how to extract images from a ppt file. PowerPoint stores images in a separate OLE stream named Pictures. Extracting image data from it is not difficult, I will commit the patch in a couple of days. Regards, Yegor DN Hi. DN I've been testing POI lately on Word, Excel and PowerPoint documents DN with the goal of extracting text from those document types, and I have DN to say that the scratchpad in the latest alpha is quite good for DN extracting text from even PowerPoint documents. DN But, is it possible to use the API to extract embedded images from these DN documents as well? DN Daniel - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/