apache-poi

Java - org.apache.poi.ss.usermodel.Font.setBold(Z)V while trying to make a Excel Sheet, gives NoSuchMethodError

*爱你&永不变心* 提交于 2019-12-11 17:18:29
问题 So, I have this application where data is sent to me and I have to make it into an Excel sheet. I use Eclipse IDE, I do not have any errors in the code I have written. But it gives an exception at setBold(bold) method. Here is the stacktrace Sep 27, 2017 5:03:03 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/<appName>] threw exception [Handler processing failed; nested exception is java.lang.NoSuchMethodError:

How to add an altChunk element to a XWPFDocument using Apache POI

大城市里の小女人 提交于 2019-12-11 17:03:40
问题 I would like to add HTML as an altChunk to a DOCX file using Apache POI. I know that doc4jx can do this with a simpler API but for technical reasons I need to use Apache POI. Using the CT classes to do low level stuff with the xml is a little tricky. I can create an altChunk with following code: import java.io.File; import java.io.FileOutputStream; import javax.xml.namespace.QName; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFParagraph; import

Not able to insert image into excelsheet

坚强是说给别人听的谎言 提交于 2019-12-11 16:48:43
问题 Hi I am trying to insert image into excel in android, using the following code but not able to do so, please help !! // Create a path where we will place our List of objects on external // storage File file = new File(context.getExternalFilesDir(null), "abc.xls"); FileOutputStream fileOS = null; //add picture data to this workbook. InputStream is = text.getResources().getAssets().open("images.jpg"); byte[] bytes = IOUtils.toByteArray(is); int pictureIdx = wb.addPicture(bytes, Workbook.PICTURE

Insert a checkbox in an Excel sheet using Apache POI

半腔热情 提交于 2019-12-11 16:36:26
问题 I want to pragmatically insert a number of checkbox in different cells. I want to keep a reference for each one in order to read them later on after the user check or uncheck. Can I do that in Java POI ? if not what is other alternatives to do it? thank you 回答1: You can create custom check box with macros with help of Microsoft visual basic+java , in java alone that facility is not available 来源: https://stackoverflow.com/questions/15243438/insert-a-checkbox-in-an-excel-sheet-using-apache-poi

Java excel: Get next cell in the row

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 16:24:56
问题 I am trying to get the value of the next cell in a after a string is found. Let's say I get A1 as the cell that contains my search string "here", I am trying to get the contents of the next cell after A1 in the row. private static String findRow(XSSFSheet sheet, String cellContent) { for (Row row : sheet) { for (Cell cell : row) { if (cell.getCellType() == Cell.CELL_TYPE_STRING) { if (cell.getRichStringCellValue().getString().trim().equals(cellContent)) { cell = cell.getNextRowCell //made up

Plot Line Graph using org.openxmlformats.schemas.drawingml.x2006.chart

自闭症网瘾萝莉.ら 提交于 2019-12-11 16:16:11
问题 1I want to plot three lines in a graph using Apache POI with OpenXmlFormats in excel,however i can plot two lines, but not able to plot third line i don,t know why. so kindly help me to plot three lines in single graph. i am sharing code for ploting 2-lines.. [2] i have add a picture that i want in result. [3] how to plot multiple chart in single excel file. public class LineChart { public static void main(String[] args) throws Exception { String filename = "e:/Graph_5.xlsx"; if(filename!

How to hide particular column in pivot table not in sheet?

浪子不回头ぞ 提交于 2019-12-11 16:14:10
问题 Text above pivot I want to hide one column in pivot table. If I remove that column then the functionality gets effected. How can I achieve that functionality by removing or hiding that column in pivot table? ` public class Createxlsx { public static void main(String[] args) throws FileNotFoundException, IOException, InvalidFormatException { createPivotTable(); } private static void createPivotTable() throws IOException, FileNotFoundException { try (XSSFWorkbook wb = new XSSFWorkbook()) {

Apache POI How to add a custom DataFormatter for handling 13 digit integers as strings, not numbers

别来无恙 提交于 2019-12-11 16:08:11
问题 I'm building a XLSX processor that transforms a XLSX into a CSV file. Because the files can get quite big, I'm using the event-based approach using XSSFSheetXMLHandler This works perfectly fine, but my XLSX files contains long numbers (13 digits) which are unique identification numbers, not real numbers. When running my code on a Windows machine it correctly extracts the numbers, but when running on a Linux machine it converts it to E-notation. For example: the source value is 7401075293087.

How to store data from excel to ArrayList<ArrayList<String>>

血红的双手。 提交于 2019-12-11 15:57:22
问题 I have data from excel like this 111 | 222 | 333 | 444 | 555 | 666 11 | 12 | 13 | 14 | 15 | 16 1 | 2 | 3 | 4 | 5 | 6 a | b | c | d | e | f and my code goes like this public static void main(String[] args) { try { FileInputStream file = new FileInputStream(new File("xxx")); XSSFWorkbook wb = new XSSFWorkbook(file); XSSFSheet sheet = wb.getSheetAt(0); DataFormatter formatter = new DataFormatter(); ArrayList<ArrayList<String>> mainArrayList = new ArrayList<ArrayList<String>>(); ArrayList<String>

'Stream closed' exception occurs

这一生的挚爱 提交于 2019-12-11 15:48:42
问题 Recently i am developing a code to export data to excel. I used apache POI for developing this functionality. Please consider the below code. public static void prepareDateForCSVGeneration(List<DataList> dataList,HttpServletResponse response) throws CashBookingInquiryServiceApplicationException { try (ServletOutputStream out = response.getOutputStream()) { XSSFWorkbook workbook = new XSSFWorkbook(); //below method creates headers and rows convertToExcel(workbook, dataList); response