Hi,
Presently I am working on Aspose PPTX slides in java. I
am trying to convert RichText support for the PDF generation using
PPTx file.Please let me know if there is any library available for
RichText format using ASOPSE Slides for Java.
Here I am attaching the code below for the Normal Text Format which was implemented:.But I need code for to generate it in
private static void replaceTextField(Presentation presentation, String strToFind, Field field) {
System.err.println(“The String value to find is::”+ strToFind);
ITextFrame[] textFrames = SlideUtil.getAllTextFrames(presentation, true);
for (int i=0; i<textFrames.length; i++) {
for (IParagraph para : textFrames[i].getParagraphs()) {
List newPorts = new ArrayList();
for (IPortion port : para.getPortions()) {
if (port.getText().contains(strToFind)) {
int index = port.getText().indexOf(strToFind);
IPortion port1, port2, port3;
if (index > 0) {
port1 = new Portion((Portion)port);
port1.setText(port.getText().substring(0, index));
newPorts.add(port1);
}
port2 = new Portion((Portion)port);
if (field.isRequired() != null && field.isRequired() && StringUtils.isEmpty(field.getValue())) {
port2.setText(strToFind);
// Required field is missing, highlight the field
port2.getPortionFormat().getFillFormat().getSolidFillColor().setColor(Color.RED);
port2.getPortionFormat().getFillFormat().setFillType(FillType.Solid);
} else {
if (StringUtils.isEmpty(field.getValue())) {
port2.setText("");
} else {
port2.setText(field.getValue());
}
}
newPorts.add(port2);
if (index + strToFind.length() < port.getText().length()) {
port3 = new Portion((Portion)port);
port3.setText(port.getText().substring(index+strToFind.length()));
newPorts.add(port3);
}
// port.setText(port.getText().replace(strToFind, field.getValue()));
} else {
newPorts.add(port);
}
}
para.getPortions().clear();
for (IPortion newPort : newPorts) {
para.getPortions().add(newPort);
}
textFrames[i].joinPortionsWithSameFormatting();
textFrames[i].getTextFrameFormat().setAutofitType(TextAutofitType.Normal);
}
}
}
Currently we are using aspose-slides-15.3.0-jdk16.jar for aspose slides.
Can you please let me know from which version supports RichTextArea.
Please find the attachments related to the the input for the slide.
Here I am sending input html format which comes to the method.
Please find the below format:
- Business level workshop
- Technical workshop(s)
and please find the expected output as attachment.
But I need the code for RichText format
Please update me with exact code to for the slide to generate in the PDF. We are in a critical phase and need your urgent attention to this matter.