apache-poi

Where to put autoSizeColumn in Apache POI?

让人想犯罪 __ 提交于 2021-01-28 07:36:13
问题 I have been working on Apache POI XSSF model for quite some time now. I'm trying to generate a excel sheet which is formatted and have some set of styles applied. For performance reasons i have been using the Big-Grid example provided by POI. https://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/BigGridDemo.java. Along with this i also want to apply the autoSizeColumn for each of the columns. But i'm not sure where should i apply the autoSizeColumn

Setting Table borders to THICK

孤街醉人 提交于 2021-01-28 05:55:26
问题 I would like to create a table with thick borders. I've been searching for a while but it seems that the style THICK does not work. If I select other styles such as DOUBLE it's fine but for instance, if I select THIN_THICK_SMALL_GAP it creates two thin lines. The code I'm using is: CTTblPr tblpro = table.getCTTbl().getTblPr(); CTTblBorders borders = tblpro.addNewTblBorders(); borders.addNewBottom().setVal(STBorder.THICK); borders.addNewLeft().setVal(STBorder.THICK); borders.addNewRight()

How do I convert an area in an Excel doc to a table using Apache POI?

巧了我就是萌 提交于 2021-01-28 05:35:47
问题 I've written an application that fetches data from a database and creates an Excel doc from said data using the XSSF classes in the Apache POI library. I've imported poi, poi-ooxml, and poi-ooxml-schemas, all version 4.1.0. The file gets written fine and there are no errors when opening the file until I uncomment the table creation code, which I'll paste below: CellReference topLeft = new CellReference(sheet.getRow(3).getCell(0)); CellReference bottomRight = new CellReference(sheet.getRow

POI bar chart generate one series has question

馋奶兔 提交于 2021-01-28 05:10:08
问题 I use JDK8 and POI-4.1.0 use they example here a link export chart to Word .when create two series is ok two series img, but I only create one series .the chart mistake category for series one series img "lang1" "lang2" "lang3" is category name but they become series name. i have no ideal. I also find use line chart have the same problem my code public static void main(String[] args) throws Exception { List<String> listLanguages = new ArrayList<>(3); listLanguages.add("lang1");listLanguages

FileOutputStream (Apachhe POI) taking too long time to save

☆樱花仙子☆ 提交于 2021-01-28 03:36:28
问题 When I am edit a .xlsx file using Apache poi, its taking too long to save. The .xlsx file contains, formulas formatting and freeze pane. I am using the following code, try { FileInputStream file = new FileInputStream(new File(path)); XSSFWorkbook fWorkbook = new XSSFWorkbook(file); XSSFSheet fSheet = fWorkbook.getSheetAt(0); for(int i = 0; i < jTable1.getRowCount(); i++){ if(jTable1.getModel().getValueAt(i, index1).equals("1")){ XSSFCell cell = fSheet.getRow(i+1).getCell(index1); cell

Problem adding image in the header of word document

大兔子大兔子 提交于 2021-01-28 02:06:57
问题 I'm adding a picture in the header of a word document. It shows a frame for the image and says "the image cannot currently be display". If I add text to the header it show the text, and if I add the image in the document body, it also shows the image. So is getting the image and it show text on the header, but no the image. I'm running out of checkings, can anyone advise with this please? Thank you! public static void createHeaderAndFotter(XWPFDocument document) throws IOException,

Apache POI Date Parsing One Second Off

自古美人都是妖i 提交于 2021-01-27 17:48:06
问题 I'm parsing an Excel spreadsheet with a date in it. The results from POI are off by 1 second compared to what's displayed in Excel. The unformatted data in Excel is: 43261.5027743056 The cell in Excel has a format of: mm/dd/yyyy hh:mm:ss The field in Excel displays as: 6/10/2018 12:04:00 PM The POI parser (v 4.0.1 and 4.1.0 both) parse it as: Value: 43261.502774305598 Format: mm/dd/yyyy\ hh:mm:ss Result: 6/10/2018 12:03:59 PM Here's my code: private final DataFormatter formatter; case NUMBER:

writing a new cell to a sheet apache poi

十年热恋 提交于 2021-01-27 16:47:03
问题 i am using following code, for reading a excel using apache poi, its a .xlsx file. Please let me know what i can do, to also alter a value of a cell, in each row as my loop keeps going. Thanks import java.io.FileInputStream; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; String fileName = "C:/createCDN.xlsx"; FileInputStream fis = null; fis = new

Reading Excel file with Scala

早过忘川 提交于 2021-01-27 14:50:36
问题 I am writing a quick test that registers a user with the data from a spreadsheet. The idea is Go to the website > click register > Read excel rows A1 and B1 for email and password > use this data on registration site> finish the registration > log out > Register a new user with information from rows A2 and B2 > continue until rows in the spreadsheet are empty. I have managed to automate the registration process with random user information and now I just need to make it do the same with the

Reading Big XLS and XLSX files

拟墨画扇 提交于 2021-01-27 04:30:10
问题 I'm aware of the posts that are around, I've tried several attempts to reach my objective, as I will elaborate below: I have a .zip / .rar , that contains multiple xls & xlsx files. Each excel file contains duzens up to thousands of rows, around 90 columns give or take (each excel file can have more or less columns). I've created a java windowbuilder application, where I select a .zip / .rar file and select where to unzip these files to and create them using FileOutputStream . After each file