B4J Library MashMSWord: Beginning MS Word Tables

Ola

At some stage I will need to work with MS Word Tables, this is my attempt to do do using Inline Java.

Dependencies: poi-3-17 / jPOI Library

Output:

MashMSWord.png


Reproduction

B4X:
Dim msword As MashMSWord
    msword.Initialize
    msword.Create(File.DirApp,"msword.docx")
    msword.AddParagraph("Anele Mbanga")
    msword.AddParagraph("Loves")
    msword.AddParagraph("B4J")
    'add a table
    Dim cols As List
    cols.Initialize
    cols.AddAll(Array As String("First Name","Nick Name","Last Name","Date of Birth","Place of Birth"))
    msword.AddTable(1,cols)
    'create the records to add
    Dim records As List
    records.Initialize
    records.Add(CreateMap("f":"Anele","n":"Mashy","l":"Mbanga","d":"1973-04-15, Sun","p":"East London"))
    records.Add(CreateMap("f":"Anele1","n":"Mashy1","l":"Mbanga1","d":"1973-04-15, Sun","p":"East London"))
    records.Add(CreateMap("f":"Anele2","n":"Mashy2","l":"Mbanga2","d":"1973-04-15, Sun","p":"East London"))
    records.Add(CreateMap("f":"Anele3","n":"Mashy3","l":"Mbanga3","d":"1973-04-15, Sun","p":"East London"))
    
    msword.AddRecords(1,records)
    msword.save
    msword.OpenFile

Attached example with class:

Happy Coding
 

Attachments

  • MasMSWord.zip
    2.9 KB · Views: 316
Top