B4J Question Add or create Html in MS Word Documents (Solved)

LGS

Member
Licensed User
Longtime User
Hello everyone.
I am creating 2 lists in a word document using paragraphs (small program is attached).

But I need to create those 2 lists like the following html:
1708658709673.png

HTML:
<!DOCTYPE html>
<html>
<head>
<style>
.twoTexts {
writing-mode: vertical-rl;;
}
</style>
</head>
<body>

<table border-collapse: collapse;  width: 100%; >

<textarea class="twoTexts" rows="30" cols="23">
First line (textarea 1)
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Last line
</textarea>

<textarea class="twoTexts" rows="30" cols="23">
First line (textarea 2)
Line 12
Line 13
Line 14
Line 15
Line 16
Line 17
Line 18
Line 19
Last line
</textarea>

</table>
</body>
</html>

You can try the html code here:

I would appreciate any ideas or help to be able to create the textarea of the html code in the Word document

Thanks in advance
 

Attachments

  • HtmlWord.zip
    2.9 KB · Views: 106
Last edited:

LGS

Member
Licensed User
Longtime User
Hi Marco.
Yes, I am using XLUtils to create the Word document.
In the attachment, the Word document is created without problem.

But in XLUtils paragraphs are used, and the text is created from top to bottom.

What I need?
That in the Word document the text can be written from right to left, just as it is created in the html using textarea

I don't know if the following is possible:
When creating the word document using XLUtils, html code can be inserted directly into Word document
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
It doesn't seem to me that the table has a property where you can set whether it's vertical or horizontal.
If so, you could take other paths, for example:
In any case you could use a hidden webview, insert the desired html code, extract a jpg image and paste the same into the word document.

B4X:
Sub WebView1_PageFinished (Url As String)
.....
Dim mybitmap As Bitmap
mybitmap = WebView1.CaptureBitmap

End Sub
 
Upvote 0

teddybear

Well-Known Member
Licensed User
Hello everyone.
I am creating 2 lists in a word document using paragraphs (small program is attached).

But I need to create those 2 lists like the following html:
View attachment 151097
HTML:
<!DOCTYPE html>
<html>
<head>
<style>
.twoTexts {
writing-mode: vertical-rl;;
}
</style>
</head>
<body>

<table border-collapse: collapse;  width: 100%; >

<textarea class="twoTexts" rows="30" cols="23">
First line (textarea 1)
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Last line
</textarea>

<textarea class="twoTexts" rows="30" cols="23">
First line (textarea 2)
Line 12
Line 13
Line 14
Line 15
Line 16
Line 17
Line 18
Line 19
Last line
</textarea>

</table>
</body>
</html>

You can try the html code here:

I would appreciate any ideas or help to be able to create the textarea of the html code in the Word document

Thanks in advance
Do you want to create a word doc like this?
1708882125792.png
 
  • Like
Reactions: LGS
Upvote 0

teddybear

Well-Known Member
Licensed User
Yes.
I'm using XLUtils to create the word document
XLUtils is a wrapper of poi-5.0.0, it does not support TextDirection, you can use poi-5.1.0+ for that.

Download poi-5.1.0 here and move the jar to additional folder

The project is attached.
 

Attachments

  • HtmlWord.zip
    3.4 KB · Views: 139
Last edited:
Upvote 0
Solution
Top