apache-poi

How to set default value in Apache POI pivot table report filter

对着背影说爱祢 提交于 2019-12-20 03:19:09
问题 I have a worksheet with data in it, I am trying to create a pivot table with report filter. I want to set default value to the report filter. pivotTable.addReportFilter(13); column contains 0's and 1's, I would like to set 0 as my default value in the report filter. 回答1: At first this question is not answerable in that general context as it is asked now. Creating pivot tables using apache poi is in beta state until now. So we need not only the high level apache poi API but also the underlying

Read images from .xls file together with the references for their locations

妖精的绣舞 提交于 2019-12-20 03:10:00
问题 In one of my projects I need to read images from an .xls file. For each row there is a column containing an image which I need to read out. It looks like I can read all the images together, but how can I also get the position of each image, like column and row numbers, so I can relate those images with other data? 回答1: As long as the shapes are pictures, the following is possible: import org.apache.poi.hssf.usermodel.*; import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.util.*;

POI: Append rows to existing workbook

こ雲淡風輕ζ 提交于 2019-12-20 02:32:27
问题 Using XSSFWorkbook, is it possible to append rows to an existing sheet? I am doing multiple writes (which was a PITA to solve due to a bug) and while I can write out new sheets multiple times, it does not appear that I can append. What I am currently doing is the following: Read sheet to my workbook. Load workbook. Append rows to workbook in memory Write out again. 4 Does not appear to work, just ignores it completely! I am aware that SXSSFWorkbook exists, but attempting to convert my

Apache POI - Cant get Line Chart Values to appear in the Secondary Axis

一曲冷凌霜 提交于 2019-12-20 01:58:14
问题 I can't get the Line Chart Values to appear on the Secondary Axis of the chart. When I open the excel file, I can get the chart the way I want just by clicking on top of the line series with the right button and select "Format Data Series",It appears that the secondary axis is selected, but my chart isn't the way I want, and when I select primary axis and then again secondary axis, it works. It doesn't make sense. It would be good if there was a function for putting the ValAx in the Secondary

MessageBodyWriter not found for media type=application/octet-stream, type=class org.apache.poi.xssf.usermodel.XSSFWorkbook

帅比萌擦擦* 提交于 2019-12-20 01:11:10
问题 I have the below class that tries to return some data in the form of an excel spreadsheet. I'm getting the error MessageBodyWriter not found for media type=application/octet-stream, type=class org.apache.poi.xssf.usermodel.XSSFWorkbook I've also tried @Produces("application/vnd.ms-excel") , but have gotten similar errors. Anyone have a suggestion as to how I can get this to return a spreadsheet? The last time I got an error message similar to this (complaining that a message body writer

Using a newer version of Apache POI in ColdFusion 10

我的未来我决定 提交于 2019-12-20 00:10:20
问题 I would like to use newer version of Apache POI with ColdFusion 10 than the one with which it ships, as I need to access some of the newer functionality. I have tried swapping ColdFusion's Apache POI JAR files for the newer versions but this causes some of the built in ColdFusion spreadsheet functionality to break. Is it possible to load in the newer version for use in my code but leave ColdFusion's version untouched so that the built in spreadsheet functionality still works? I know it is

Apache POI HSSF Streaming

南笙酒味 提交于 2019-12-19 21:44:44
问题 Is there someway to use or implement XLS streaming like their new SXSSF streaming API? I need to deal with huge XLS and XLSX Spreadsheets, but since their HSSF does not have any streaming available I always have heap space problems (comming to 1GB and errors). Does anyone have any suggestions with POI? 来源: https://stackoverflow.com/questions/9134830/apache-poi-hssf-streaming

How to copy some content in one .docx to another .docx , using POI without losing format?

风格不统一 提交于 2019-12-19 19:03:36
问题 Suppose I have two .docx files, input.docx and output.docx I need to select some of the content in input.docx and copy them to output.docx . The newdoc displays its content in the console seems correct, but I did not get anything in the output.docx , except blank lines. Can anyone provide advices? InputStream is = new FileInputStream("D:\\input.docx"); XWPFDocument doc = new XWPFDocument(is); List<XWPFParagraph> paras = doc.getParagraphs(); List<XWPFRun> runs; XWPFDocument newdoc = new

How to copy some content in one .docx to another .docx , using POI without losing format?

我们两清 提交于 2019-12-19 19:03:14
问题 Suppose I have two .docx files, input.docx and output.docx I need to select some of the content in input.docx and copy them to output.docx . The newdoc displays its content in the console seems correct, but I did not get anything in the output.docx , except blank lines. Can anyone provide advices? InputStream is = new FileInputStream("D:\\input.docx"); XWPFDocument doc = new XWPFDocument(is); List<XWPFParagraph> paras = doc.getParagraphs(); List<XWPFRun> runs; XWPFDocument newdoc = new

apache poi: saving jtable to a file

落花浮王杯 提交于 2019-12-19 18:55:46
问题 I've recently started working with java and I'm facing some issues with the apache poi library when I need to create an excel file starting from a jTable. I've read many threads and come up with some code which just won't work (even if this is pretty easy stuff and there were many examples, which makes me look even more dumb) and I was hoping someone could help me out. So here are the questions: a) why does the for loop, which is supposed to write the excel file, not fill every cell? (the