apache-poi

Change font style in a specific word from docx file using Java Apache POI

安稳与你 提交于 2021-01-29 07:11:16
问题 I'm using Apache POI XWPF to manipulate a docx file, I need to update some words of paragraph and change the font style of it. For updating a single word, it's ok, let's assume that my docx content has the paragraphs bellow: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer pretium sodales nisl, ut ornare ligula vehicula vitae. Fusce non magna feugiat, sagittis massa at, fermentum nibh. Curabitur auctor leo vitae sem tempus, facilisis feugiat orci vestibulum. Mauris molestie

Apache POI: ${my_placeholder} is treated as three different runs

删除回忆录丶 提交于 2021-01-29 06:44:26
问题 I have a .docx template with placeholders to be filled, such as ${programming_language} , ${education} , etc. The placeholder keywords must be easily distinguished from the other plain words, hence they are enclosed with ${ } . for (XWPFTable table : doc.getTables()) { for (XWPFTableRow row : table.getRows()) { for (XWPFTableCell cell : row.getTableCells()) { for (XWPFParagraph paragraph : cell.getParagraphs()) { for (XWPFRun run : paragraph.getRuns()) { System.out.println("run text: " + run

how to ensure ctdocument attribute sequence in apache poi xwpf

亡梦爱人 提交于 2021-01-29 05:03:31
问题 EDIT[FIX] - see at bottom. MS office genrates this element in all documents with some underlying knowledge that the NS constraints must be enforced to a degree... MS document example: <w:document xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:v="urn:schemas-microsoft

Apache docx CreateWatermark Set font in text oR CTTextPath setstyle remove double/single quotes

夙愿已清 提交于 2021-01-28 19:05:00
问题 I am using the code from here by extending this calss https://svn.apache.org/viewvc/poi/tags/REL_3_17_FINAL/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java?view=markup#l416 COde from this : CTTextPath shapeTextPath = shape.addNewTextpath(); shapeTextPath.setStyle("font-family:"Cambria";font-size:1pt"); Tried various combination and permutation but in the end in xml it removes it and prints like : <v:textpath style="font-family:Cambria;font-size:1pt" string="test"/> Any

Is TestNG Not Possible To Repeat Class?

柔情痞子 提交于 2021-01-28 11:24:30
问题 I'm trying to build a data driven automation test with TestNG as main framework and apache-poi as data source (using .xlsx file), I'll to use this for selenium purposes. This is example the selected scenario from excel file: See image detail here It can be chosen randomly, according to the user who uses it. The pattern can be purchase all, consume all, or mix. And the expectations run in the order chosen. So far this is the code I've created: Master class public class Master { public static

getPivotCacheDefinition return null value when Refresh Pivot Table with Apache POI

﹥>﹥吖頭↗ 提交于 2021-01-28 10:48:33
问题 I want to refresh pivot table after enter data to data sheet I read two previous questions [this][1] and [this][2]. there two way to do this one way is Right click your pivot table -> pivotTable Options -> Data -> Check Refresh Data when opening File this is working I want a automated way so I tried in this way FileInputStream inputStream = new FileInputStream(new File(excelFilePath)); workbook = new XSSFWorkbook(inputStream); XSSFSheet sheet = workbook.getSheet("Summary"); XSSFPivotTable

How to send a file via email without storing it in storage first using spring boot? [duplicate]

拟墨画扇 提交于 2021-01-28 10:47:57
问题 This question already has answers here : How to send email with attachment using InputStream and Spring? (5 answers) Closed 4 months ago . I am working on a spring boot application. In my project I am creating a .xlsx file and then i have to send via email using spring boot. I am able to create the file using apache poi but later to send it via mail as an attachment, i should save the file somewhere in local and then move the file back in while sending it as an attachment. Is there any way in

How to send a file via email without storing it in storage first using spring boot? [duplicate]

空扰寡人 提交于 2021-01-28 10:42:34
问题 This question already has answers here : How to send email with attachment using InputStream and Spring? (5 answers) Closed 4 months ago . I am working on a spring boot application. In my project I am creating a .xlsx file and then i have to send via email using spring boot. I am able to create the file using apache poi but later to send it via mail as an attachment, i should save the file somewhere in local and then move the file back in while sending it as an attachment. Is there any way in