B4J Library MashMSWord: Beginning MS Word Tables

Discussion in 'B4J Libraries & Classes' started by Mashiane, Aug 8, 2018.

  1. Mashiane

    Mashiane Expert Licensed User

    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

    Code:
    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
     

    Attached Files:

  2. liulifeng77

    liulifeng77 Active Member Licensed User

    it can merge cells?
     
    joulongleu likes this.
  3. Mashiane

    Mashiane Expert Licensed User

    At the moment haven’t found anything close to doing that yet.
     
    joulongleu likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice