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 / May 2008

Tip: Looking for answers? Try searching our database.

Word. VC++6.0. How I can retrieve current number row?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Antonio - 07 May 2008 15:30 GMT
Hello,
I have an application in VC++ 6.0. This application creates a .DOC file for
Word2007. In this file I insert text and image (.bmp)

This is my problem:
When I insert text and/or image how I can retrieve current row?
I need to get current number row. Someone can help me with sample code in
VC++?

Thanks
Jean-Guy Marcil - 07 May 2008 16:05 GMT
> Hello,
> I have an application in VC++ 6.0. This application creates a .DOC file for
[quoted text clipped - 4 lines]
> I need to get current number row. Someone can help me with sample code in
> VC++?

What do you mean by "Row"?
Are you inserting your text and bitmap in a table?
If not, there is a "line" property in Word 2003 and above, but it is not
straight forward to use...

What do you mean by "Current"? Since you are automating the document
creation, there is no such thing as a "Current" selection.

Once you answer these questions, I can probably provide sample code in VBA,
not C++, you will need to translate it...

Finally, why don't you tell us why you need this information...? There might
be an easier way of doing things... If you use the Range object, you do not
need to know "line number" to know where you are at...
Antonio - 08 May 2008 17:51 GMT
Thanks for reply. Excuse my not perfect english.
I need retrieve information from status bar.
Cursor position: current line (row).
When I produce a .DOC file (insert text) with my application in VC++6.0 I
must know at what line number I have reached.
I hope have being clear.

Bye
Jean-Guy Marcil - 08 May 2008 18:23 GMT
> Thanks for reply. Excuse my not perfect english.
> I need retrieve information from status bar.
> Cursor position: current line (row).
> When I produce a .DOC file (insert text) with my application in VC++6.0 I
> must know at what line number I have reached.
> I hope have being clear.

In VBA, you need:

MsgBox Selection.Information(wdFirstCharacterLineNumber)

You can also use this with the Range object:

Dim rngCurrent As Range

Set rngCurrent = Selection.Range

With rngCurrent
   MsgBox .Information(wdFirstCharacterLineNumber)
End With

But why do you need this? You can't really use that to do anything at all
while building a document...
Antonio - 12 May 2008 08:22 GMT
I need to control end of page.
In this document there are pictures, tables. I need formatting this element
in paper...
There is a alternative mode for to control to pass next page?
Jean-Guy Marcil - 13 May 2008 13:43 GMT
> I need to control end of page.
> In this document there are pictures, tables. I need formatting this element
> in paper...
> There is a alternative mode for to control to pass next page?

If you mean that you will monitor the "wdFirstCharacterLineNumber" value
before and after every move you make, then, yes, you can use that to detect
if you have moved on to a new page. You could also use
".Information(wdActiveEndPageNumber)". Also, you could just get the total
number of pages in the document ".Information(wdNumberOfPagesInDocument)"...
Whenever it increases, you have just added a page.

Make sure you use a "Range" object and not the "Selection" object. It will
make your code more reliable and faster to execute.
Antonio - 14 May 2008 09:13 GMT
Thanks for information.
Now I must translate your information in VC++.
I hope to find right correspondence.

Bye
 
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.