Hi,
I wanted to trim the leading and trailing spaces of the paragraph text. I am iterating through the runs to build a string, removing the runs along the way and creating a paragraph with the new trimmed string.
However, if the paragraph contains hyperlink run.getText() returns some garbage string (like \HYPERLINK), is there any alternative to achieve this using Aspose 15.8.
Attached the sample doc for your reference,
Here is the code snippet:
for (Run run : (Iterable<Run>) paragraph.getRuns()) {
stringBuilder.append(run.getText());
run.remove();
}
// Trim the text and add back to the same paragraph
Run trimmedRun = new Run(doc, stringBuilder.toString().trim());
paragraph.appendChild(trimmedRun);
Regards,
Prem Latha