Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / July 2007

Tip: Looking for answers? Try searching our database.

How to get the hight of context in a Microsoft word in C#?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
vincent - 16 Jul 2007 05:08 GMT
I need to know the hight of context in a Microsoft word.
Then set the Page hight equte the hight of context.
Does anyone know how to do that?
Russ - 16 Jul 2007 08:03 GMT
I am not sure what you want.
If you want to view one page in the window, then use the menu 'View/Page
Layout', then move to the 'Zoom' dropdown list in the main toolbar and
select 'Whole Page'. If you want to go to a certain page use menu Edit/Go
To...

> I need to know the hight of context in a Microsoft word.
> Then set the Page hight equte the hight of context.
> Does anyone know how to do that?

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

vincent - 16 Jul 2007 08:24 GMT
thank you very much.

> I am not sure what you want.
> If you want to view one page in the window, then use the menu 'View/Page
[quoted text clipped - 5 lines]
> > Then set the Page hight equte the hight of context.
> > Does anyone know how to do that?
vincent - 16 Jul 2007 08:50 GMT
I use  Word Application object to operate a Microsoft Word file.

I would like to know the current the hight of a specific cell in the table.

When the HeightRule is wdRowHeighAuto and the Height propertys always be
9999999.0.

How to do get the current Height of the cell?

// Declaring the object variables we will need later
               object varFileName = "c:\\test\\CellTest.docx";
               object varFalseValue = false;
               object varTrueValue = true;
               object varMissing = Type.Missing;
               // Create a reference to MS Word application
               Microsoft.Office.Interop.Word.Application varWord = new
Microsoft.Office.Interop.Word.Application();
               //set printer
               varWord.ActivePrinter = "Microsoft Office Live Meeting
Document Writer";
               // Creates a reference to a word document
               Microsoft.Office.Interop.Word.Document varDoc =
varWord.Documents.Open(ref varFileName, ref varMissing, ref varFalseValue,
ref varMissing, ref varMissing, ref varMissing, ref varMissing, ref
varMissing, ref varMissing, ref varMissing, ref varMissing, ref varMissing,
ref varMissing, ref varMissing, ref varMissing, ref varMissing);
               // Activate the document
               varDoc.Activate();



string HeightRule =varDoc.Tables[1].Cell(0, 0).HeightRule.ToString();
float testHight=varDoc.Tables[1].Cell(0, 0).Height;

> I am not sure what you want.
> If you want to view one page in the window, then use the menu 'View/Page
[quoted text clipped - 5 lines]
> > Then set the Page hight equte the hight of context.
> > Does anyone know how to do that?
Doug Robbins - Word MVP - 16 Jul 2007 20:25 GMT
The difference between
Selection.Information(wdVerticalPositionRelativeToPage) for the text in the
cell in question and that in the cell in the next row should give you what
you want.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

>I use  Word Application object to operate a Microsoft Word file.
>
[quoted text clipped - 39 lines]
>> > Then set the Page hight equte the hight of context.
>> > Does anyone know how to do that?
vincent - 17 Jul 2007 12:26 GMT
Thank you very much for your replying.
Thank you.

> The difference between
> Selection.Information(wdVerticalPositionRelativeToPage) for the text in the
[quoted text clipped - 44 lines]
> >> > Then set the Page hight equte the hight of context.
> >> > Does anyone know how to do that?
vincent - 18 Jul 2007 02:28 GMT
can you give a c# example
Thank you very much.

> The difference between
> Selection.Information(wdVerticalPositionRelativeToPage) for the text in the
[quoted text clipped - 44 lines]
> >> > Then set the Page hight equte the hight of context.
> >> > Does anyone know how to do that?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.