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

RE: Word. VC++6.0. How I can retrieve current number row? by JeanGuyMarcil

JeanGuyMarcil
Wed May 07 08:05:01 PDT 2008

"Antonio" wrote:

> 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++?

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


RE: Word. VC++6.0. How I can retrieve current number row? by Antonio

Antonio
Thu May 08 09:51:01 PDT 2008


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


RE: Word. VC++6.0. How I can retrieve current number row? by JeanGuyMarcil

JeanGuyMarcil
Thu May 08 10:23:03 PDT 2008

"Antonio" wrote:

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

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

Antonio
Mon May 12 00:22:03 PDT 2008


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?

RE: Word. VC++6.0. How I can retrieve current number row? by JeanGuyMarcil

JeanGuyMarcil
Tue May 13 05:43:00 PDT 2008

"Antonio" wrote:

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

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

Antonio
Wed May 14 01:13:01 PDT 2008


Thanks for information.
Now I must translate your information in VC++.
I hope to find right correspondence.

Bye