Re: Building Word documents using C#

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,

Thanks - I was assuming (or perhaps hoping) that adding text at a bookmark
would overwrite the spaces rather than move them forwards.

I did think about trying to replace the text - however I assume this
requires replacing the correct number of empty spaces as well.

Thanks Again

Andrew

--
Andrew Mercer
-----------------


"Cindy M." wrote:

Hi Andrew,

I think there's a misconception on your part about how Word documents
function...

If you add spaces between some text, then push more text in-between, the spaces
aren't removed.

You could use a two-column table to achieve the layout you describe.
You could set a left-aligned tabstop at the position of the second "column",
then press TAB at the end of the text in the first "column" (removing all the
spaces that are currently there)
You could place the text in the second "column" in a text box or a frame from
the Forms toolbar.

Which option to use depends very much on the end-use of the document. I suggest
you experiment a bit with these in the Word UI to determine which best meets
your needs.

I am building a word document using C# and Word .NET Programmability however
I have a question that I cannot find the answer for.

I have designed the Word template with embedded bookmarks.

When I build the document I dynamically place text at each book mark position.

The base document also has some other fixed text in it.

However in the completed document the original text is always moved.

EG:

Original document

MyText More MyText

Completed document

MyText [C# Added Text] More MyText

It seems that the original text is moved along a number of tab spaces
depending on the size of the text being added.

Is there anyway to prevent this so that the layout of the completed document
is the
same as the original (the only difference is the added text)?

I know that the spaces I left in the template are sufficient for the text I
want to add.


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)


.



Relevant Pages

  • Re: Building Word documents using C#
    ... then press TAB at the end of the text in the first "column" (removing all the ... I have designed the Word template with embedded bookmarks. ... However in the completed document the original text is always moved. ... This reply is posted in the Newsgroup; please post any follow question or reply ...
    (microsoft.public.office.developer.automation)
  • Re: Page numbering conversion from Mac version FIle Series
    ... Mark the numpages field in doc1 with a bookmark "TotPages" ... This message is posted to a newsgroup. ... >>"Master Document" is a term of art in Word referring to ... >>a start on using calculation fields in page numbering. ...
    (microsoft.public.word.formatting.longdocs)
  • Re: Table wont hide
    ... Please reply to the newsgroup unless you wish to avail yourself of my ... is accomplished by wrapping the content in a bookmark and setting the ... Public Sub HideBookmarkRange ... paragraph before the table. ...
    (microsoft.public.word.vba.general)
  • Re: Clearning Bookmark data
    ... Please reply to the newsgroup unless you wish to avail yourself of my ... Doug Robbins - Word MVP, ... It really would help if I could blank out existing data following a bookmark ...
    (microsoft.public.word.vba.general)
  • Re: Auto duplicating regions?
    ... Please post all follow-ups to the newsgroup. ... user to have to change their Word options. ... So, looks like macro is ... cross-reference to a bookmark without having to manually type in the bookmark ...
    (microsoft.public.word.docmanagement)