Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7129219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:13:11+00:00 2026-05-28T11:13:11+00:00

I have a master table in one word document. First column of the table

  • 0

I have a master table in one word document.

First column of the table has keys. I have to create another table based upon the keys (rows) selected by the user.

The user can select a key (row) more than one time.

Table1:

TaskName    Data       Group
abc         data1      group1
pqr         data2      group2
lmn         data3      group3

TaskName column is the key column, A user can select abc,pqr,abc,pqr,lmn

This should generate a table as follows:

TaskName    Data       Group
abc         data1      group1
pqr         data2      group2
abc         data1      group1
pqr         data2      group2
lmn         data3      group3

I cannot use table.Cell().Range.Text as by doing this formatting is lost.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T11:13:12+00:00Added an answer on May 28, 2026 at 11:13 am

    I tried first using Word.Selection, but I could not figure out a way in which I can take one row at a time and copy paste it. It might be possible to do using Word.Selection.

    The next thing I thought about was copy pasting a cell at a time, but Range Property keeps a hold of table cell structure. I looked into the Word Model and tried to find out if there is some kind of termination character after every row to distinguish it as end of row. There is such a character but it’s for all the cells. To find this character out, click on the office button(besides Home), click on word options, click on display,in the section always show these formatting marks on the screen, tick show all formatting marks. This displays all the non-printable characters in a word document. This is the symbol you’ll be able to see ¤.

    This symbol holds the structural information of the cell and the exposed ANSI characters are 13 + 7. 13 is a paragraph mark and 7 is the “end-of-cell”marker. This holds further information that points to cell structure management in the file. In Word 2007 these two characters appear as one character, so what we need to do is drop this character from the cell’s Range.

    I created a list to hold all the cells that I need from the master Table.

    List<Microsoft.Office.Interop.Word.Cell> masterTableCells=new List<Microsoft.Office.Interop.Word.Cell>();
    

    After that the following code removes the last character from Range

                        Microsoft.Office.Interop.Word.Table table = b.Range.Tables[1];
    
                    table.ID = b.Name;
                    for (int colCounter = 1; colCounter <= masterTable.Columns.Count; colCounter++)
                    {
                        Microsoft.Office.Interop.Word.Range sourceRange = masterTable.Cell(1, colCounter).Range;
                        Microsoft.Office.Interop.Word.Range targetRange = table.Cell(1, colCounter).Range;
                        object oCharacter = Microsoft.Office.Interop.Word.WdUnits.wdCharacter;
                        object negOne = -1;
                        sourceRange.MoveEnd(oCharacter, negOne);
                        targetRange.MoveEnd(oCharacter, negOne);
                        targetRange.FormattedText = sourceRange.FormattedText;
    
                    }
    

    The purpose was to obtain formatted text and by removing the character from each cell Range , we are able to point to only that particular cell’s structure and not the whole tables.

    If you try to run a loop with only formatted text property, you will get a table corrupt error. Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 tables- master and detail table. Master Table has ID column which
I have a fairly huge database with a master table with a single column
I have need to select a number of 'master' rows from a table, also
I have to tables, Table A is master, table B child. What is the
I've two master tables Org & Item and then there's an OrgItem table.I have
I have a master table called parent and a related table called childs Now
My application has one table called 'events' and each event has approx 30 standard
I have a complex MySQL query that joins three tables and self-joins one table
I have a need to copy a worksheet from one workbook into another and
I have three tables [USER] --Master user table [KEYWORD] --Master keyword table [USER_KEYWORD] --[USER]-[KEYWORD]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.