How hard to wrap this https://github.com/leonardoanalista/java2word lib ?
How much money ?
How much money ?
import word.api.interfaces.IDocument;
import word.w2004.Document2004;
import word.w2004.elements.BreakLine;
import word.w2004.elements.Heading1;
import word.w2004.elements.Paragraph;
#AdditionalJar : srw
Dim Font As JavaObject
Font.InitializeNewInstance("com.itseasy.rtf.text.Font",Array("FAMILY_ROMAN","TIMES_NEW_ROMAN"))
Dim TextPart As JavaObject
TextPart.InitializeNewInstance("com.itseasy.rtf.text.TextPart",Array("Your centerd text" ))
Dim Paragraph As JavaObject
Paragraph.InitializeNewInstance("com.itseasy.rtf.text.Paragraph",Array(28, 0, 34,Font.GetField("TIMES_NEW_ROMAN"),TextPart))
Paragraph.RunMethod("setAlignment",Array(Paragraph.GetField("ALIGN_CENTER")))
Dim PageSize As JavaObject
PageSize.InitializeStatic("com.itseasy.rtf.text.PageSize")
Dim doc As JavaObject
doc.InitializeNewInstance("com.itseasy.rtf.RTFDocument",Array(PageSize.GetField("DIN_A4_QUER")))
doc.RunMethod("setViewscale",Array(doc.GetField("VIEWSCALE_FULLPAGE")))
doc.RunMethod("addParagraph",Array(Paragraph))
'
Dim jFile As JavaObject
jFile.InitializeNewInstance("java.io.File",Array(File.Combine(File.DirRootExternal,"myfile.doc")))
doc.RunMethod("save",Array(jFile))
Paragraph.RunMethod("addText",Array(TextPart))
doc.RunMethod("getDocument",Null)
I have had some success accessing this library using JavaObject
I don't know whether this library will fulfil your needs but you might give it a shot
Looks like this is placed as base64encoded string maybe? Looks like this or not?i can see "B0D3D1D1CaC8C9 D2C5CaD1D2" in the result file
I believe this function should be editedLooks like this is placed as base64encoded string maybe? Looks like this or not?
private String getHeader() {
return "\\rtf" + RTFVERSION // RTF Version, damit beginnt jedes RTF Dokument
+ "\\ansi\\ansicpg1252" // <charset> -> Default, ANSI mit Mitteleuropنischen Zeichensatz
+ "\\deff" + this.deffont.getFontnumber() + "{" + getFonttable() + "}" // <fonttbl> -> Schriftentabelle
+ "{" + getColortable() + "}" // <colortbl> -> Farbtabelle
// \stylesheet ... http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnrtfspec/html/rtfspec_6.asp
+ "{\\*\\generator " + GENERATOR + ";}"; // Generatorname
}
I believe this function should be edited
+ "\\ansi\\ansicpg1252" // <charset> -> Default, ANSI mit Mitteleuropنischen Zeichensatz
{\uc1 \u168 ?}{\uc1 \u183 ?}{\uc1 \u711 ?}{\uc1 \u713 ?}{\uc1 \u8213 ?}{\uc1 \u8214 ?}{\uc1 \u8217 ?}{\uc1 \u8221 ?}{\uc1 \u8230 ?}{\uc1 \u8758 ?}{\uc1 \u12289 ?}{\uc1 \u12290 ?}{\uc1 \u12291 ?}{\uc1 \u12293 ?}{\uc1 \u12297 ?}{\uc1 \u12299 ?}{\uc1 \u12301 ?}{\uc1 \u12303 ?}{\uc1 \u12305 ?}{\uc1 \u12309 ?}{\uc1 \u12311 ?}{\uc1 \u65281 ?}{\uc1 \u65282 ?}{\uc1 \u65287 ?}{\uc1 \u65289 ?}{\uc1 \u65292 ?}{\uc1 \u65294 ?}{\uc1 \u65306 ?}{\uc1 \u65307 ?}{\uc1 \u65311 ?}{\uc1 \u65341 ?}{\uc1 \u65344 ?}{\uc1 \u65372 ?}{\uc1 \u65373 ?}{\uc1 \u65374 ?}{\uc1 \u65504 ?}}{\*\lchars ([\'7b{\uc1 \u183 ?}{\uc1 \u8216 ?}{\uc1 \u8220 ?}{\uc1 \u12296 ?}{\uc1 \u12298 ?}{\uc1 \u12300 ?}{\uc1 \u12302 ?}{\uc1 \u12304 ?}{\uc1 \u12308 ?}{\uc1 \u12310 ?}{\uc1 \u65288 ?}{\uc1 \u65294 ?}{\uc1 \u65339 ?}{\uc1 \u65371 ?}{\uc1 \u65505 ?}{\uc1 \u65509 ?}...................
I started wrapping it Wish me good luckReplaceing "ansicpg1252" into another charset in the result file - nothing good for viewing :-(
But if to re-save the result .DOC by WPS Office Writer - the new .DOC contains RU text in UNICODE
And replace ansicpg1252 into RU charset ansicpg1251.B4X:{\uc1 \u168 ?}{\uc1 \u183 ?}{\uc1 \u711 ?}{\uc1 \u713 ?}{\uc1 \u8213 ?}{\uc1 \u8214 ?}{\uc1 \u8217 ?}{\uc1 \u8221 ?}{\uc1 \u8230 ?}{\uc1 \u8758 ?}{\uc1 \u12289 ?}{\uc1 \u12290 ?}{\uc1 \u12291 ?}{\uc1 \u12293 ?}{\uc1 \u12297 ?}{\uc1 \u12299 ?}{\uc1 \u12301 ?}{\uc1 \u12303 ?}{\uc1 \u12305 ?}{\uc1 \u12309 ?}{\uc1 \u12311 ?}{\uc1 \u65281 ?}{\uc1 \u65282 ?}{\uc1 \u65287 ?}{\uc1 \u65289 ?}{\uc1 \u65292 ?}{\uc1 \u65294 ?}{\uc1 \u65306 ?}{\uc1 \u65307 ?}{\uc1 \u65311 ?}{\uc1 \u65341 ?}{\uc1 \u65344 ?}{\uc1 \u65372 ?}{\uc1 \u65373 ?}{\uc1 \u65374 ?}{\uc1 \u65504 ?}}{\*\lchars ([\'7b{\uc1 \u183 ?}{\uc1 \u8216 ?}{\uc1 \u8220 ?}{\uc1 \u12296 ?}{\uc1 \u12298 ?}{\uc1 \u12300 ?}{\uc1 \u12302 ?}{\uc1 \u12304 ?}{\uc1 \u12308 ?}{\uc1 \u12310 ?}{\uc1 \u65288 ?}{\uc1 \u65294 ?}{\uc1 \u65339 ?}{\uc1 \u65371 ?}{\uc1 \u65505 ?}{\uc1 \u65509 ?}...................
I started wrapping it Wish me good luck
not really. Just wanted to try the sample to see if it worksI think DonManfred also started wrapping this library
..... But it works! At least with german umlauts.