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 7218021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T21:25:41+00:00 2026-05-28T21:25:41+00:00

Given something like Table table; Cell cell_1 = table.Cell(2,2); Cell cell_2 = table.Cell(4,4); I

  • 0

Given something like

Table table;
Cell cell_1 = table.Cell(2,2);
Cell cell_2 = table.Cell(4,4);

I want to select (or highlight) from cell_1 to cell_2 (like how you would if you were doing it by hand).

I originally thought that doing the following would work:

Selection.MoveRight(wdUnits.wdCell, numCells, WdMovementType.wdExtend)

But according to http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.selection.moveright%28v=office.11%29.aspx under remarks, using wdCells as the Unit will default the WdMovementType to wdMove, and I can’t think of a workaround.

  • 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-28T21:25:42+00:00Added an answer on May 28, 2026 at 9:25 pm

    Here is a workaround I’ve found to the problem. It isn’t the most efficient way, and it doesn't work if the table has merged cells in it. I’ve discovered that you can select the range of your start cell, and then expand the end point of the range by moving by in units of cells. By discovering the number of cells between the start and end point of the region you want selected, you can iterate those number of cell steps. Here’s the general code for that below:

    word.Table table;
    word.Cell cellTopLeft; //some cell on table.
    word.Cell cellBottomRight; //another cell on table. MUST BE BELOW AND/OR TO THE RIGHT OF cellTopLeft
    
    int cellTopLeftPosition = (cellTopLeft.RowIndex - 1) * table.Columns.Count + cellTopLeft.ColumnIndex;
    int cellBottomRightPosition = (cellBottomRight.RowIndex - 1) * table.Columns.Count + cellBottomRight.ColumnIndex;
    int stepsToTake = cellBottomRightPosition - cellTopLeftPosition;
    
    if (stepsToTake > 0 && 
        cellTopLeft.RowIndex <= cellBottomRight.RowIndex && //enforces bottom right cell is actually below of top left cell
        cellTopLeft.ColumnIndex <= cellBottomRight.ColumnIndex) //enforces bottom right cell is actually to the right of top left cell
    {
       word.Range range = cellTopLeft.Range;
       range.MoveEnd(word.WdUnits.wdCell, stepsToTake);
       range.Select();      
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have SELECT name FROM table which gives me something like foo
Given something like: namespace :my_tasks do task :foo do do_something end task :bar do
Given [1,2,3,4,5] , how can I do something like 1/1, 1/2, 1/3,1/4,1/5, ...., 3/1,3/2,3/3,3/4,3/5,....
For example, given a type param method i'm looking for something like the part
I want to give default value to a textarea. The code is something like
This was something originally discussed during a presentation given by Charles Brian Quinn of
BACKGROUND: I would like to have small labels in columns of a table. I'm
Given a table like ID | Name | City 1 | X | Y
I have a table storing millions of rows. It looks something like this: Table_Docs
I'm looking at reducing the memory consumption of a table like collection object. Given

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.