Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I created a .dot, and put a simple table. The fields, TESTE_1 and TESTE_2 are from "Quick Parts >> Field " I want to populate this table from database (external files, or whatever) using C# Code.

enter image description here

I put a "MergeField" in the table cells (Test1). There a lot of codes showing how to "find and replace" these bookmarks, But how to fill a table I not found, like:

Column1 | Column2 Foo | Bar Zee | Top.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
283 views
Welcome To Ask or Share your Answers For Others

1 Answer

Since your main problem is how to locate the table in the document, then work with it:

  1. Select the table and insert a Bookmark around it. This will allow your code to pick up the table directly:

    Word.Table tbl = Doc.Bookmarks.get_item("Name").Range.Tables[1];

  2. Here's an article that will help you working with tables in Word. It also discusses performance issues: https://msdn.microsoft.com/en-us/library/aa537149%28v=office.11%29.aspx?f=255&MSPPError=-2147217396


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...