apache-poi

How do I fix SpreadSheetAddRows function crashing when adding a large query?

守給你的承諾、 提交于 2020-01-22 19:40:33
问题 EDIT3: Thanks to the help of @Leigh I've narrowed down the problem to the date columns in the query. Using the original code set and POI, the page crashes when SpreadSheetAddRows() attempts to add a very large query that contains date-like cells. I've made a bug report here: https://bugbase.adobe.com/index.cfm?event=bug&id=3432184. I have a query that I am adding to a spreadhseet object that seems to error when the query has an unweildly amount of rows (18583 in this example). The exact error

How do I fix SpreadSheetAddRows function crashing when adding a large query?

99封情书 提交于 2020-01-22 19:39:47
问题 EDIT3: Thanks to the help of @Leigh I've narrowed down the problem to the date columns in the query. Using the original code set and POI, the page crashes when SpreadSheetAddRows() attempts to add a very large query that contains date-like cells. I've made a bug report here: https://bugbase.adobe.com/index.cfm?event=bug&id=3432184. I have a query that I am adding to a spreadhseet object that seems to error when the query has an unweildly amount of rows (18583 in this example). The exact error

Apache POI set Excel chart title

十年热恋 提交于 2020-01-22 19:29:45
问题 I'm creating an Excel workbook from scratch. One of the sheets contains a chart, and I want to set the chart title. Apache POI has a setChartTitle method on HSSFChart, but neither XSSFChart nor the format-agnostic Chart have methods to set the chart title. Since I need to create .xlsx files this is a problem for me. After much poking around in POI code and OOXML specifications I managed to come up with this code for setting the title on a newly created Chart: if (chart instanceof XSSFChart) {

Apache POI for Excel: Setting the cell type to “text” for an entire column

寵の児 提交于 2020-01-22 18:56:08
问题 I need to generate an .xls (Excel) file, using the Java library Apache POI for spreadsheets. The file will contain a list of phone numbers in column A, formatted as "0221...." or "+49221..." - so Excel by default interprets them as numeric cells. This is bad, because the leading 0 or + will get trimmed. To solve the problem, I can use cell.setCellType(Cell.CELL_TYPE_STRING) , which works fine, but only for the specific cells I set this for. How can I apply this setting for the entire column

Detect needed print orientation with Apache POI

冷暖自知 提交于 2020-01-22 18:23:53
问题 I'm using Apache POI to create xls spreadsheets. Is there a way to detect if the data fits in portrait mode or if I have to set the sheet to landscape mode? I know how to set the modes, but I don't know how to find out if the data fits the current print orientation. 回答1: I've tried but cant see a way to get this working. When you create the workbook, poi defaults the Fit Height and Width to 1 each. Fit Height is the number of pages high to fit sheet in and Fit Width is the number of pages

Apache POI shiftRows corrupts file and deletes content

∥☆過路亽.° 提交于 2020-01-22 02:24:08
问题 I want to fill table a template excel file. I want to insert rows and fill them. I used java Apache POI library to access excel files. At first, I created a new file and filled column A from row 1 to 10 with 1..10 numbers and saved the file. Then I read the file and tried to insert a single empty row with a sheet.shiftRows() method. I tried below code but output file has a problem in the opening (reading) and rows 5,6,7 are empty and move has not occurred. InputStream inputStream = new

Apache poi Excel line chart points

我与影子孤独终老i 提交于 2020-01-19 16:40:38
问题 I am creating an Excel file with line chart. I've created chart and filled it with data but I cannot create points on my chart. Does anyone know, is there a way I could generate these points(triangles, squares, circles etc.) in a chart using apache poi? This is my code for generating current char: public static void main(String[] args) throws Exception { Workbook wb = new XSSFWorkbook(); Sheet dataSheet = wb.createSheet("linechart"); final int NUM_OF_ROWS = 10; final int NUM_OF_COLUMNS = 4;

Apache poi Excel line chart points

好久不见. 提交于 2020-01-19 16:38:59
问题 I am creating an Excel file with line chart. I've created chart and filled it with data but I cannot create points on my chart. Does anyone know, is there a way I could generate these points(triangles, squares, circles etc.) in a chart using apache poi? This is my code for generating current char: public static void main(String[] args) throws Exception { Workbook wb = new XSSFWorkbook(); Sheet dataSheet = wb.createSheet("linechart"); final int NUM_OF_ROWS = 10; final int NUM_OF_COLUMNS = 4;

Apache POI. Copying sheets

好久不见. 提交于 2020-01-19 12:05:26
问题 I'm using apache poi to create an excel document. To create new sheet in workbook I write next code: Workbook wb = new HSSFWorkbook(); Sheet sh = wb.createSheet(); this code create and add sheet to workbook. But I want to create sheet formerly and then add it to workbook. Smth like this: Sheet sh = new HSSFSheet(); wb.addSheet(sh); I need such thing, because I want to copy data from one sheet of one workbook to another sheet of another workbook(Workbook interface has method Sheet cloneSheet

Basic Excel currency format with Apache POI

女生的网名这么多〃 提交于 2020-01-19 00:42:47
问题 I'm able to get cells to format as Dates, but I've been unable to get cells to format as currency... Anyone have an example of how to create a style to get this to work? My code below show the styles I'm creating... the styleDateFormat works like a champ while styleCurrencyFormat has no affect on the cell. private HSSFWorkbook wb; private HSSFCellStyle styleDateFormat = null; private HSSFCellStyle styleCurrencyFormat = null; ...... public CouponicsReportBean(){ wb = new HSSFWorkbook();