Hope all are good. I am relatively new to Boxable and PDFBox and was hoping someone could help me in this regard. I am trying to generate a PDF using PDFBox and since I was required to create tables which I did, now I need to put a hyperlink text in it. I am trying but unable to find any help on this. I know PDFBox has a way of doing it using 'PDAnnotationLink' but that is not working when I'm trying to insert it into a Boxable Cell since that requires only String values.
Bit of my code is something like this,
Row<PDPage> row = table.createRow(rowHeight);
Cell<PDPage> cell = otherDocumentsRow.createCell(30, "Other Documents");
String str = "Attachment link here";
cell = row.createCell(70, str);
Now instead of str text, I am looking to insert a hyperlink text which points to some location (www.example.com). Is this possible or is there a workaround around this.
Thank you in advance and looking forward to hearing from you
Related
I am currently trying to create a .docx Document using docx4j.
I have already created a few tables, and want to change the background- and text-color of the first table row.
table in question
I would like to create a void function which gets a Tc (table cell) and String (color) as an argument.
I actually havent found any help online.
Thanks in advance :)
You could use the Docx4j Helper WordAddin or webapp to generate Java code from a suitable example docx.
I am trying to convert Html string to Excel using Aspose Cells. I am trying to convert negative number to number with parenthesis and comma and the number to be aligned in such a way that the decimal point comes in single line as shown in the below image.
For the html string, I am creating a table in jquery where I am inserting mso-number-format in the string as show below.
I am adding the image because I was not able to edit it to show the exact format.
var html += '<td style='+msoStyle+'>(1,234)</td><td style='+msoStyle+'>1,234</td>';
The mso-number-format can be found in ms excel --> Number --> Custom option
When I check the generated html, the css looks like this :
Html page :
When I re-generate html string from the html table, the css style looks like this :
The excel generated from Aspose cells is giving me below output
Aspose cells version : 19.6
Java version : 1.8
Can you guys please help me where exactly I am going wrong. If you have any different solution for what I am trying to achieve, please let me know.
Regards,
Ashish M
I want to change Text_Direction (not Alignment) of a single cell (not worksheet) on an excel file using java Apache_poi library.
how can I do it? thanks.
after looking a lot I found another way that will fix the problem.
As explained here , it's just needed to change the direction of the text that will be placed in the cell.
the solution will be like below for right to left:
String rtl = "\u200F" + otherTexts;
and like this for LTR:
String left2right_text = "\u200E" + otherTexts;
I'm writing to inquire a bout a problem when I'm using iText library to extract text contents from PDF file.I would able to extract all the text, but couldn't find the method to extract font styles.
First you need to read the answer to this question: how can i get text formatting with iTextSharp
In this question, you'll discover that the TextRenderInfo has a getFont() method that allows you to get the PostScriptFontName. If you are in luck, this PostScriptFontName will give you information about the style.
Note that this won't always work. Please read the answer to this question: What are the ways of checking if piece of text in PDF documernt is bold using iTextSharp
That question shows an example of a font that doesn't reveal anything about its style.
To get the fontsize of a font in itext, use this code:
renderInfo.getAscentLine().getStartPoint().get(1)-
renderInfo.getDescentLine().getStartPoint().get(1)
This will give you the exact fontsize.
I am displaying text in a Java JEditorPane using HTML to fomrat the text. I am also designing a search function that finds text in the JEditorPane selects the text and then scrolls to it. My problem is creating an algorithim that will actually specify the beginning and ending position for the selection.
If I simply retrieve the text using myeditorpane.getText(), then find the search string in the result, the wrong selection start and end positions are calculated with the wrong text being selected (the tags are throwing the calculation off). I tried removing the html tags by executing a replace all function text.().replaceAll("\<.*?>","") before searching for the text (this replace all removes all text in between the tags) but still the wrong selection points are calculated (although I'm getting close :-)).
Does anyone have an easy way to do this?
Thanks,
Elliott
You probably want to be working with the underlying Document, rather than the raw text, as suggested in this HighlightExample.
You need to find the start location of the text. I guess something like:
int offset = editorPane().getDocument().getText().indexof(...);
Then to scroll you can use:
editorPane.scrollRectToVisible( editorPane.viewToModel(offset) );
Read up on Text and New Lines for more info.