ingomohr / docwriter

API to write docx documents
MIT License
1 stars 0 forks source link

Add Example for Tables via Markdown #51

Open ingomohr opened 3 years ago

ingomohr commented 3 years ago

Adding tables via markdown already works. However, it's not documented nor is there an example for tables. Pls improve document and add an example.

Something like:

SimpleDocxProcessor proc = new SimpleDocxProcessor();
proc.createDocument();

proc.addHeadlineH1("Table Example");

// @formatter:off
String table 
         = " Key | Value \n"
     + " --- | ---\n"
     + " 43  | Answer to *all* questions + 1 \n";
// @formatter:on

proc.addMarkdown(table);

Path path = Paths.get(System.getProperty("user.home") + "/Desktop/test.docx");

try {
    proc.saveDocumentToPath(path);
} catch (IOException e) {
    e.printStackTrace();
}

image