apache-poi

Java: Apache POI: Can I get clean text from MS Word (.doc) files?

对着背影说爱祢 提交于 2019-12-18 13:05:22
问题 The strings I'm (programmatically) getting from MS Word files when using Apache POI are not the same text I can look at when I open the files with MS Word. When using the following code: File someFile = new File("some\\path\\MSWFile.doc"); InputStream inputStrm = new FileInputStream(someFile); HWPFDocument wordDoc = new HWPFDocument(inputStrm); System.out.println(wordDoc.getText()); the output is a single line with many 'invalid' characters (yes, the 'boxes'), and many unwanted strings, like

How can I convert POI HSSFWorkbook to bytes?

扶醉桌前 提交于 2019-12-18 11:40:43
问题 Calling Simple toBytes() does produce the bytes but exel throws Warning. Lost Document information Googling around gave me this link and looking at Javadocs for worksheet and POI HOW-TO say similar things . Basically I can not get Bytes without loosing some information and should use the write method instead. While write does work fine I really need to send the bytes over . Is there any way I can do that ? That is get the bytes with out getting any warning . 回答1: As that mailing list post

Error while reading Excel sheet using Java

只谈情不闲聊 提交于 2019-12-18 11:11:37
问题 I'm working with Spring/Hibernet using NetBeans 6.9.1. I'm trying to read an Excel file (.xlsx- Office 2007). The code for reading an Excel file is as follows using a Vactor to store data from the Excel sheet. import java.io.FileInputStream; import java.util.Iterator; import java.util.Vector; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import model.NewHibernateUtil; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf

Creating a .docx file using poi-ooxml jar file

旧时模样 提交于 2019-12-18 09:51:45
问题 I am trying to create a simple .docx file using Apache POI-ooxml jar file. When I add the jar, all looks well and Eclipse doesn't complain of any error. But when I run the app, apps crashes saying: 02-19 11:05:36.555: E/AndroidRuntime(17223): java.lang.VerifyError: org/apache/poi/xwpf/usermodel/XWPFDocument 02-19 11:05:36.555: E/AndroidRuntime(17223): at com.example.filegenerator.MainActivity$2.onClick(MainActivity.java:177) 02-19 11:05:36.555: E/AndroidRuntime(17223): at android.view.View

Java DecriptionInfo on Word DocX

a 夏天 提交于 2019-12-18 09:41:22
问题 I'm pulling my hair out as I cannot get the samples to work - hopefully someone can help.. I would like to DETECT if a docx and a doc file is password protected/encrypted. I have seen this posted in a few places but I cannot get it work - it doesnt throw an exception. Can someone see what I am doing wrong. Note I only need to detect the password..i dont want to open the document. String fileLocation = "C:/myfile.docx"; File file = new File(fileLocation); FileInputStream fis = new

How to store values from excel to some collection in java [closed]

非 Y 不嫁゛ 提交于 2019-12-18 09:37:48
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . i have a excel file like the following, **Method Name** **Status Code** **user** **password** getLoggedinUserDetails 400 anto test createRequisition 400 mayank hexgen excelMDM 400 xxxxx hexgen createOrder 400

Apply Fill Colors and Borders to Excel Range Using Apache POI

a 夏天 提交于 2019-12-18 09:37:18
问题 I am working on converting an Excel VBA Script to Java using Apache POI and I am stuck. In VBA it is easy to apply both Fill Colors and Borders to cells in succession. But in POI it seems almost impossible without creating hundreds of XSSFCellStyles [(Every Color Used) x (Every Border Combination) x (Every Font Used)]. I am trying to recreate this spreadsheet, which is currently produced via VBA: Spreadsheet Image The code below is intended to begin formatting by filling the top two rows gray

Is there any way to know that the CellStyle is already present in Workbook(to reuse) using POI or to Copy only Celstyle obj not reference

自作多情 提交于 2019-12-18 09:04:09
问题 I want to write some records into excel but I got to know that the maximum cell styles in XSSFWorkbook is 64000 .But records exceeding more than 64000 and consider I want to apply new cellstyle to each cell or I will clone with the already existing cell style. Even to clone I need to take default cell style workbook.createCellStyle(); but this exceeds for 64001 record which leads to java.lang.IllegalStateException: The maximum number of cell styles was exceeded. . So is there anyway in POI to

Data row limits on cfspreadsheet

这一生的挚爱 提交于 2019-12-18 09:03:45
问题 I am loading about 20,000 rows into a <cfspreadsheet> . It throws an error: When I limit the number of rows to 15,000, I don't get an error. Is there a hard limit on the number of rows <cfspreadsheet> supports? 回答1: This sounds similiar to the issue I had here: How do I fix SpreadSheetAddRows function crashing when adding a large query?. If you have CF10 then you might be in luck 'cause that should be fixed now (as of Update 10 at least). 来源: https://stackoverflow.com/questions/19214735/data

How to get chart info from an Excel spreadsheet using Apache POI?

杀马特。学长 韩版系。学妹 提交于 2019-12-18 08:56:19
问题 Is it possible to extract chart information from an Office 2007 (xlsx / OpenXML) spreadsheet using Apache POI? I've managed to read in the spreadsheet and even get the part that refers to the chart but not sure how I can retrieve any info from this part e.g. Type of chart, chart data etc. XSSFWorkbook xwb = new XSSFWorkbook("charts_lines.xlsx"); XSSFSheet sheet = xwb.getSheetAt(0); I can also iterate through the package parts to retrieve the chart part, but I don't see how I then go on to