apache-poi

Change font size in text box - apache poi word docx

∥☆過路亽.° 提交于 2019-12-13 03:44:45
问题 I found the answer that explains how to insert a new text box into docx document. create text box in document .docx using apache poi The problem is that I cannot change the font size inside a newly created text box. Does anyone know how to do that? 回答1: Reference : create text box in document .docx using apache poi The ctTxbxContent.addNewP() in my code creates a CTP object. The XWPFParagraph has a constructor XWPFParagraph(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP prgrph,

Apache POI. How do I set the page layout / paper size for a Word document?

↘锁芯ラ 提交于 2019-12-13 03:35:21
问题 I am trying to create a Word document from scratch using the Apache POI package. Outputting simply-formatted text has not proved to be a problem but I would like to change the page size. How do I set the page layout / paper size for a Word document? Can anyone point me to useful examples for using POI to create Word documents? 回答1: For example if you want to set the A4-format you can use this code: Document document = new Document(PageSize.A4); 回答2: In C# with NPOI I use document.PageLayout

How to open password protected docx file in java?

扶醉桌前 提交于 2019-12-13 03:33:09
问题 I want to open a password protected docx file using Apache POI. Can anyone help me with the complete code please? Am not getting solution with this code Exception in thread "main" org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF) at org.apache.poi.poifs.storage.HeaderBlock.

Why I cannot get values from excel into a list using my codes?

谁都会走 提交于 2019-12-13 03:27:00
问题 I would like to gather the relevant Excel cells into a list for a sequence comparison. However, I failed to get those cell values with conditions into the list by using below codes (nothing is printed in console as expected). I tried using startsWith and other condition syntax but I am not sure if this is the issue or I did sth wrong in prior. HSSFSheet dispcolsheet = workbook2.getSheet(0); Iterator<Row> colRowItr = dispcolsheet.rowIterator(); List<String> colstatuslist = new ArrayList<String

Apache POI in executable jar

﹥>﹥吖頭↗ 提交于 2019-12-13 03:24:23
问题 My program successfully runs the Apache POI functionality to read Excel Files. It works fine when I run it with java class name. When I package as an executable jar it does not work. Here is the error message I keep getting: java -jar some.jar Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Row at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class

Java Apache POI Tab Stop word document

故事扮演 提交于 2019-12-13 02:37:11
问题 I have a word document that has lines like the following A name (aligned left) and a price (aligned all the way to the right) both on the same line. I believe this is done by a tab-stop in a word document. Here is an example, see the first line. Is it possible for me to print out into a word document, a line like the first one? I checked around the documentation for apache POI but didn't see anything that allowed you to set a tab stop. However, I wasn't sure if there is another way to get the

POI Java Date to Excel seconds difference

ぃ、小莉子 提交于 2019-12-13 02:12:14
问题 guys. I'm having some trouble when exporting dates from Java to Excel cells using Apache POI library. It's a marvelous tool and very easy to understand and use, but right now it is giving me some headaches! Here's the thing: I'm writing an application that validates certifications using a code made out of 2 letters followed by 9 digits. The last 4 digits are made by the sum of each number representing day, month and year as well as hour, minute and seconds in the instant the code generation

Apache POI supports only ScatterCharts and LineCharts why?

我的未来我决定 提交于 2019-12-13 01:34:18
问题 I see that only LineChart and Scatter Charts are supported by default with Apache POI . Question: How can we add Other Chart types in spreadhsheet.. Any Idea or any help on this? or Is there Any reason for apache supporting only these two types of charts. 回答1: Apache poi provides poi-ooxml-schemas also. This are the underlying objects for XML based office documents. So one can try solving his requirements directly with those objects as long as they are not provided at higher level. The

How to read password protected excel files using POI (with Eevnt model)?

只愿长相守 提交于 2019-12-13 01:23:45
问题 I want to read password protected excel files (.xls and .xlsx) with Apache POI. I am not using the usermodel (org.apache.poi.ss.usermodel) but an Event API to process xls and xlsx files (to address the memory footprint issue). I am implementing HSSFListener and overriding its processRecord(Record record) method for xls files. For xlsx files I am using javax.xml.parsers.SAXParser and org.xml.sax.XMLReader. If I use below code to read .xls file: Biff8EncryptionKey.setCurrentUserPassword(

How do I add a second line with a SECOND AXIS to an XDDFChart in POI 4.0.1?

非 Y 不嫁゛ 提交于 2019-12-12 23:19:41
问题 I am unable to add a line on a second axis (right axis) on an existing chart. Is there a way to do this with the new implementation of Charts in POI 4.0.0/1? Desired output will look like this (A simple excel chart with 2 axes): . The associated data to that chart as an example: Series 1/Axis1 = [1, 2, 3, 4, 5, 6, 7, 8, 9] Series 2/Axis2 = [200,300,400,500,600,700,800,900,1000] Here is the code that I am trying so far in Java, it is mostly replicated from the LineChart.java example //Initial