apache-poi

Apache POI - How to restrict the user to clear the data validations in excel sheet

[亡魂溺海] 提交于 2019-12-12 06:01:20
问题 I have set up a Data validation on my sheet using Apache POI. The validation is like it allows only the decimal numbers. It was working fine without any issues. But when user clears the validations on excel sheet he will be able to enter any data which I restricted using data validations before. How can I restrict the user to clear the data validation using Apache POI ? In other words, how should I disable clear validation option for my data validation using Apache POI ? Any help would be

Java POI ClassNotFoundException

和自甴很熟 提交于 2019-12-12 05:29:45
问题 im trying to use the POI classes from apache to convert a dovx to txt. I included all the jars that the zip has, but i get this error: 05-21 21:32:04.508: E/dalvikvm(1977): Could not find class 'org.apache.poi.xwpf.usermodel.XWPFDocument', referenced from method com.example.flashcards.WordToTxt.convert 05-21 21:32:04.508: E/AndroidRuntime(1977): FATAL EXCEPTION: main 05-21 21:32:04.508: E/AndroidRuntime(1977): java.lang.NoClassDefFoundError: org.apache.poi.xwpf.usermodel.XWPFDocument 05-21 21

Running into warnings and errors using JSpreadsheet

喜夏-厌秋 提交于 2019-12-12 05:28:15
问题 I'm using JSpreadSheet to read an xlsx file from the SDCard and try as I might I cannot get the app to work. I've tried the same code in Java and it work flawlessly, outputting the cells to system.out but it doesn't seem to be working in Android. Please help ! Here's my function: public void readAndDisplay(){ try { Workbook book = new Workbook("/sdcard/new.xlsx"); for (Sheet sheet : book.getSheets()) { if (sheet instanceof Worksheet) { Worksheet worksheet = (Worksheet)sheet; List<Cell> cells

Removing chart from PowerPoint slide with Apache POI

我的梦境 提交于 2019-12-12 05:12:35
问题 We're trying to remove a chart from a PowerPoint slide using Apache POI 3.16 but we're having difficulties. Our code performs the following steps: Open an existing PowerPoint document (a template document) Add and remove slides Update charts in existing slides This works fine. At some point, we need to remove a chart from a given slide. Here's our attempt: OPCPackage pkg = ppt.getPackage(); String chartRelationId = slide.getRelationId(chart); pkg.removeRelationship(chartRelationId); pkg

JXLS Set Sheet Name

非 Y 不嫁゛ 提交于 2019-12-12 05:04:28
问题 I would like to provide a way for a sheet name to be specified by a command. The sheet names should be dynamically created based on the content in the sheet. I note that it is possible to specify fixed sheet names for dynamic sheets when using the multisheet attribute of each-command. In the version 1 documentation there is a reference to the ability to rename a sheet using ${workbook.setSheetName(0, department.name)}. Can this be used in v2? How is it supposed to work? Would workbook need to

How to set cell background color in excel using java + poi

风格不统一 提交于 2019-12-12 04:59:26
问题 So far I did bellow coding using Spring MVC. Important- I am not using here HSSFWorkbook So what is the equivalent of the POI method setCellStyle in StreamingReader InputStream is = new FileInputStream(new File("file path")); StreamingReader reader = StreamingReader.builder() .rowCacheSize(90000000) .bufferSize(4096) .sheetIndex(0) .read(is); for (Row r : reader) { Test_huge_excel_data data = new Test_huge_excel_data(); data.setCol1(r.getCell(0).getStringCellValue()); data.setCol2(r.getCell(1

How to protect parts of a word document with Apache POI

二次信任 提交于 2019-12-12 04:35:29
问题 I need to protect parts of my Word (2013) document via Java and make them read only. Is that possible with Apache POI? And if yes, how? I only found the possibility to protect the whole document. (I need to protect not only the header and footer but also some lines in the body part.) 回答1: There are multiple kinds of protection you can enforcing in an Word document. If you are enforcing read only protection, then you can exclude ranges from protection by marking them using CTPermStart and

Java Apache Poi SXSSF with Excel Macros

风流意气都作罢 提交于 2019-12-12 04:12:13
问题 I have a excel template that has macros (.xlsm), I want to read it in, add a million rows to it and write it out. I know that reading and re-writing files with POI that contain macros will preserve the macros. I need to write out the excel using SXSSF (ram limitations), but SXSSF doesn't read files. Question: How can I read in an excel with macros using XSSF, and then write out the excel with macros using SXSSF? 回答1: Apache POI supports writing a spreadsheet with a large number of rows via

How set bold for docx run apache poi

谁说我不能喝 提交于 2019-12-12 04:09:28
问题 How set bold for run with run.getCTR().getRPr()? I write this code but it doesn't work at all. run.setBold(true); I had the same problem with font-size but I fixed it with this code: CTHpsMeasure size = CTHpsMeasure.Factory.newInstance(); sizeFa.setVal(new BigInteger((sizePoint * 2) + "")); run.getCTR().getRPr().setSz(size); run.getCTR().getRPr().setSzCs(size); Now I want to set bold with code like above, with getCTR(). what should I do? Thanks. 回答1: If run.getCTR().getRPr().setSzCs(size); is

Not able to initialize org.apache.poi.xslf.usermodel.XMLSlideShow in coldfusion

大憨熊 提交于 2019-12-12 04:08:01
问题 <cfscript> filepath = ExpandPath("./1.ppt"); fis = CreateObject( "java", "java.io.FileInputStream" ).init(filepath); //initialize slideshow object with input stream src = createObject("java","org.apache.poi.xslf.usermodel.XMLSlideShow").init(fis); fis.close(); </cfscript> I am not able to initialize org.apache.poi.xslf.usermodel.XMLSlideShow object in coldfusion. Getting following error: Unable to find a constructor for class org.apache.poi.xslf.usermodel.XMLSlideShow that accepts parameters