apache-poi

Netbeans org.apache.poi - cannot access Date1904Support

故事扮演 提交于 2019-12-24 19:09:36
问题 I am creating Csv2Xlsx app in NetBeans IDE 8.2 and I got this error: --- maven-compiler-plugin:2.3.2:compile (default-compile) @ csv2xlsx --- Compiling 1 source file to C:\Users\test\Documents\NetBeansProjects\csv2xlsx\target\classes ------------------------------------------------------------- COMPILATION ERROR : ------------------------------------------------------------- com/test/csv2xlsx/Csv2Xlsx.java:[74,38] error: cannot access Date1904Support 1 error ----------------------------------

Implementing VBA's Sheet.range() function in Apache POI

◇◆丶佛笑我妖孽 提交于 2019-12-24 18:43:44
问题 All: I am pretty new to Apache POI, as the title said, I want to find according API of that Range() function, or APIs that can work together to build that function, for example: In VBA: Application.getSheets("Sheet1").Range("A2:F3") In POI, after I get the sheet, I am not sure what is best way to implement that Range(): new WorkBook(/* excel file input stream*/).getSheet("Sheet1") // then what? 回答1: There is nothing like VBA Range in apache poi until now. But what to use instead depends on

Drawing a line in excel using apache-poi

坚强是说给别人听的谎言 提交于 2019-12-24 16:45:51
问题 Can anybody write me a few lines of code showing how to write a line in a cell in excel, using apache poi ?! In plain Excel, I would go to Insert - Shapes - Line. Basicaly, make code like this: Workbook wb = new HSSFWorkbook(); Sheet sheet = wb.createSheet(); Row row=sheet.createRow(0); Cell cell = row.createCell(0); now, missing code would go here. As i searched the net, I should be using Class HSSFSimpleShape and OBJECT_TYPE_LINE. But i dont know how to implement it in my code :( I guess I

Getting Excel fill colors using Apache POI

社会主义新天地 提交于 2019-12-24 16:42:59
问题 I'm using Apache POI 3.17 to read an Excel 2013 workbook. The workbook is created and edited by users directly in Excel. I then run a Java 8 program that uses POI to read and process the workbook. Some cells are color-coded and so I need to obtain the fill color. In many cases this works fine, but there are a set of grey/silver colors where it does not work and I'm unsure as to why. As an example, the Excel cells look like this: My code for obtaining the fill color is: private String

Getting Excel fill colors using Apache POI

孤街浪徒 提交于 2019-12-24 16:42:03
问题 I'm using Apache POI 3.17 to read an Excel 2013 workbook. The workbook is created and edited by users directly in Excel. I then run a Java 8 program that uses POI to read and process the workbook. Some cells are color-coded and so I need to obtain the fill color. In many cases this works fine, but there are a set of grey/silver colors where it does not work and I'm unsure as to why. As an example, the Excel cells look like this: My code for obtaining the fill color is: private String

How to save the Word Document using POI API?

僤鯓⒐⒋嵵緔 提交于 2019-12-24 16:22:21
问题 how to save the Doc file using the same name using POI API public class readDoc { public static void main( String[] args ) { String filesname = "Hello.doc"; POIFSFileSystem fs = null; try { fs = new POIFSFileSystem(new FileInputStream(filesname; //Couldn't close the braces at the end as my site did not allow it to close HWPFDocument doc = new HWPFDocument(fs); WordExtractor we = new WordExtractor(doc); String[] paragraphs = we.getParagraphText(); System.out.println( "Word Document has " +

Apache POI Remove CTHyperlink [Low Level code]

試著忘記壹切 提交于 2019-12-24 16:00:24
问题 Continue with my actual bug: Remove XWPFHyperlinkRun Apache POI With this code: public void eliminarHyperLink(XWPFDocument doc){ XWPFHeaderFooterPolicy policy= doc.getHeaderFooterPolicy(); XWPFFooter footer = policy.getDefaultFooter(); List<XWPFParagraph> paragraphs = footer.getParagraphs(); boolean primero = false; for (XWPFParagraph xwpfParagraph : paragraphs) { List<XWPFRun> runs = xwpfParagraph.getRuns(); if(primero == true){ for (XWPFRun run : runs) { if(run instanceof XWPFHyperlinkRun)

Remove XWPFHyperlinkRun Apache POI

元气小坏坏 提交于 2019-12-24 15:45:15
问题 I have the same problem as this partner: how to remove a XWPFHyperlinkRun by poi I can't convert my .doc to .pdf because of that XWPFHyperlinkRun element. I can remove a simply run paragraph like this: for (XWPFParagraph xwpfParagraph : paragraphs) { for (int i = 0; i < xwpfParagraph.getRuns().size(); i++) { xwpfParagraph.removeRun(i); } } but hypertextlink don't...... If someone had a solution i will be really grateful. Thanks, regards. 来源: https://stackoverflow.com/questions/35075174/remove

How to delete a paragraph using XWPF - Apache POI

落花浮王杯 提交于 2019-12-24 14:29:46
问题 I am trying to delete a paragraph from the .docx document i have generated using the Apache poi XWPF. I can do it easily with the .doc word document using HWPF as below : for (String paraCount : plcHoldrPargrafDletdLst) { Paragraph ph = doc.getRange().getParagraph(Integer.parseInt(paraCount)); System.out.println("Deleted Paragraph Start & End: " + ph.getStartOffset() +" & " + ph.getEndOffset()); System.out.println("Deleted Paragraph Test: " + ph.text()); ph.delete(); } I tried to do the same

Error while trying to get the formula from an Excel workbook with Apache POI

假如想象 提交于 2019-12-24 13:49:19
问题 I'm using Apache POI to alter some values in an Excel document and then read the result from different cells. Everything went ok until I got a test document from the client. After testing it I found out that I have two issues: 1) When I try to get the value from a cell that has a formula but returns the result formatted as currency with the € sign as a prefix I get an error. 2) When I try to get the value from a cell that references another cell that is a formula (eg.: cell B20 from Sheet 3