This is a migrated thread and some comments may be shown as answers.

How to reference table from existing docx tamplate?

1 Answer 116 Views
WordsProcessing
This is a migrated thread and some comments may be shown as answers.
RJ
Top achievements
Rank 1
RJ asked on 05 Feb 2018, 01:53 PM

Is there a way to reference table from existing docx template? My template is already formatted and I just need to populate items from that table.

fileFormatProvider = New DocxFormatProvider()
Dim fileName As String = "D:\myTemplate.docx"
fileExtension = ".docx"
Using input As New FileStream(fileName, FileMode.Open)
     document = fileFormatProvider.Import(input)
End Using

Dim editor As New RadFlowDocumentEditor(document)

dim myTemplateTable as Table = editor.findTable?? (Cant find any sample or documentation to reference the table)

'Now I need to insert row after 4th row (Note that I have existing rows on 5th which is the subtotal, 6th credits, 7th expenses, 8th Grand Total)

'This new row/rows are dynamic and based on how many items

Dim myNewRow5 as TableRow = myTemplateTable.Rows(3).AddTableRow/InsertTableRow?? (cant find any sample either)

'Once I got the reference of the row I can now populate cells with my data...

 

Hoping for any information for this scenario.

Thanks in advance,

RJ

1 Answer, 1 is accepted

Sort by
0
RJ
Top achievements
Rank 1
answered on 05 Feb 2018, 04:20 PM

Was able to get table reference by looping each paragraph. Though I still cant insert row to table by index.

Tags
WordsProcessing
Asked by
RJ
Top achievements
Rank 1
Answers by
RJ
Top achievements
Rank 1
Share this question
or