apache-poi

Unable display comma value in cell content using data validation with explicit list constraint using poi

梦想的初衷 提交于 2019-12-11 15:26:14
问题 I am using Apache POI (v 3.8) for adding drop down list for cell with data validation.But comma(,) value is separated to another value in list.Other than comma (,) its working fine and check below screen shot Code DataValidation dataValidation = null; DataValidationConstraint constraint = null; DataValidationHelper validationHelper = null; XSSFWorkbook wb = new XSSFWorkbook(); XSSFSheet sheet1=(XSSFSheet) wb.createSheet("sheet1"); validationHelper=new XSSFDataValidationHelper(sheet1);

using WordToHtmlConverter converter in Apache POI

北战南征 提交于 2019-12-11 15:25:43
问题 I am trying to use WordToHtmlConverter class to convert a word document in HTML, but the documentation is not clear. The WordToHtmlConverter has a constructor taking org.w3c.dom.Document, but I don't think it is the word document. Does anyone have a sample program on how to load a word document and convert it into html. 回答1: You best bet for now is probably to look at the unit tests, eg TestWordToHtmlConverter. That will show you how to do it In general though, you pass in the xml document to

Does the XWPF of Apache POI support paragraph's authohyphenation feature?

允我心安 提交于 2019-12-11 15:16:56
问题 I know, that HWPF has this feature, but I can't find any simular in XWPF. Maybe there are workarounds for solving this problem. If you know some, please share with me. Thanks in advance! 回答1: In Word Office OpenXML the automatic hyphenation settings are set for the whole document and may be suppressed for single paragraphs. The settings for the whole document are in /word/settings.xml part of the package. This is XWPFSettings but it is not possible to get this using the high level objects of

How create three TOC with diffrent styles in docx by java?

不打扰是莪最后的温柔 提交于 2019-12-11 15:14:50
问题 How can I create three or more TOC in docx file that one of them is for Headings level 1, 2, 3 and others are for another styles which are created by program? For example, I create a style for table title and I want to create a TOC for paragraphs with this style. And I want these TOCs to be in special paragraphs not at the end of the file. Which one is better to do this, Apache-poi? docx4j ? Aspose? I write my other code with apache-poi. 回答1: Using Aspose.Words for Java, you can use

Apache POI : creating unprotected cells by default on a protected sheet

谁说胖子不能爱 提交于 2019-12-11 15:11:21
问题 When I am creating protected sheets using Apache POI, all cells are protected by default. I have to unlock each cell individually. Is it possible to protect a sheet will all cells unprotected by default (so that I protect only cells why I want). (code used) /*for sheet protection*/ sheet.protected("password"); /*creating style to unlock cell */ CellStyle unlockedCellStyle = workbook.createCellStyle(); unlockedCellStyle.setLocked(false); /*applying unlock style to cell */ cell.setCellStyle

Docx conversion

久未见 提交于 2019-12-11 14:57:24
问题 I am doing simple docx conversion app in android. File file = new File(path + "Sample1.docx"); FileInputStream fis = new FileInputStream(file); XWPFDocument document = new XWPFDocument( fis); XWPFWordExtractor extractor = new XWPFWordExtractor(document); String docText = extractor.getText(); Added the above line in my onCreate method. Included dom4j,poi3.8,poi-ooxml3.8,poi-xml-schema3.8 & xmlbeans jars in libs folder. When i run this i got the error Unable to execute dex: method ID not in [0,

Need help regarding array formulas implementation in apache poi api

浪尽此生 提交于 2019-12-11 14:56:41
问题 I got allocated updation of existing project. Previous developer used jcom api to export data to excel sheets. But jcom api don't work with 64 bit systems. I decided to change code and using apache poi api. I managed to done many methods. My problem is array formulas. I Need to implement array formulas using apache poi. Those formulas are posted below, any help will be more appreciable. Thanks in advance guys. Formulas: String formula1 = "SUM(R[-2]C/1.200)";//net income calculation from gross

Excel file created by poi API: data is there but only one row is viewable?

一曲冷凌霜 提交于 2019-12-11 14:43:31
问题 I used a simple code from online code and I was able to call the method in the code in a for loop and passing it data and row number. The file is created properly, the file's size (after refreshing my file explorer) is changed upon each insert but when i am done I open the file and I can only see the first row in there and the moment i close it the size of the file decreases from 1.5MB to 5bytes. I opened the 1.5 MB file in notepadd++ (ofcourse it opened with byte characters) I could actually

Can I use Apache-Poi to format Excel spreadsheet as a Table in Streaming Mode

走远了吗. 提交于 2019-12-11 14:37:18
问题 A regular spreadsheet (tab) in Excel can be made into a table by selecting the data and Cntl-T. (This gives each column tables header that allows filtering of values) My spreadsheets are created using Apache-Poi and the SXSSF streaming interface, I have to use the streaming interface since the spreadsheet can be quite large. Is it possible to programmatically turn each sheet into a table I came across XSSFTable class but not clear how to use it and whether it can be used in streaming mode.

Apache POI Date format partially working

妖精的绣舞 提交于 2019-12-11 14:27:24
问题 I am using poi 3.8 to create excel sheet I have some date columns which I am formitting with the below code CreationHelper ch = wb.getCreationHelper(); short df = ch.createDataFormat().getFormat("MM/dd/yyyy"); System.out.println(df); CellStyle cs = wb.createCellStyle(); cs.setDataFormat(df); Cell cell = sheet.createRow(0).createCell(0); SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy"); cell.setCellValue( sdf.parse("04/30/2013") ); sheet.setColumnWidth(0, 6000); cell.setCellStyle(cs);