none
bookmark RRS feed

Answers

  • Hi Michael,

    No, they are quite different. Section breaks can be used to start new pages (via a 'Next Page' Section break, for example) or they can be continuous (which means they can be placed anywhere on the page). And yes, you can format on a whole-of-Section basis, if that's what you want, even to the point of having different page margins. If you have different page dimesnions (eg landscape pages in a portrait-format document), 'Next Page' Section breaks are what are usually used to delineate the Sections.

    To get to the Section break insertion controls via the GUI in Word 2007 & later, go to Page Layout|Page Setup > Breaks.

    I don't know the C# code, but you'd use Word's InsertBreaks method. For example (in vba):
    Selection.InsertBreak Type:=wdSectionBreakContinuous

    The Type options for InsertBreak are:

    WdBreakType Enumeration

    Specifies type of break.

    Name Value Description
    wdColumnBreak 8 Column break at the insertion point.
    wdLineBreak 6 Line break.
    wdLineBreakClearLeft 9 Line break.
    wdLineBreakClearRight 10 Line break.
    wdPageBreak 7 Page break at the insertion point.
    wdSectionBreakContinuous 3 New section without a corresponding page break.
    wdSectionBreakEvenPage 4 Section break with the next section beginning on the next even-numbered page. If the section break falls on an even-numbered page, Word leaves the next odd-numbered page blank.
    wdSectionBreakNextPage 2 Section break on next page.
    wdSectionBreakOddPage 5 Section break with the next section beginning on the next odd-numbered page. If the section break falls on an odd-numbered page, Word leaves the next even-numbered page blank.
    wdTextWrappingBreak 11 Ends the current line and forces the text to continue below a picture, table, or other item. The text continues on the next blank line that does not contain a table aligned with the left or right

    Cheers
    Paul Edstein
    [MS MVP - Word]
    Tuesday, May 3, 2011 12:35 PM

All replies

  • Hi Michael,

    Line #s aren't a fixed concept in Word. Dpending on the capabilities of the currently-active printer, the same bookmark could appear on a different physical line on the page.

    What are you trying to achieve?


    Cheers
    Paul Edstein
    [MS MVP - Word]
    Tuesday, May 3, 2011 1:41 AM
  • In some cases I thought I could use the bookmarks to also return the start object and end object to define a range.

    Tuesday, May 3, 2011 2:54 AM
  • Hi Michael,

    If you insert Section breaks either side of the range you're interested in, then you can simply tell Word to print that Section. No need for bookmarks (which are all too easy to delete/corrupt).


    Cheers
    Paul Edstein
    [MS MVP - Word]
    Tuesday, May 3, 2011 8:26 AM
  • Is a section break the same as a page break? My requirement is to print only a section of the document. The rest of the document content needs to be displayed on the same page. It's an odd requirement. I also need to do some formatting in the section. Can I use the section break to determine which section to format? If not, how do I get the range start and end object of the sections? I need to do this with C#, not through the word ribbon or quick access bar. I'm applying this to different documents.
    Tuesday, May 3, 2011 12:22 PM
  • Hi Michael,

    No, they are quite different. Section breaks can be used to start new pages (via a 'Next Page' Section break, for example) or they can be continuous (which means they can be placed anywhere on the page). And yes, you can format on a whole-of-Section basis, if that's what you want, even to the point of having different page margins. If you have different page dimesnions (eg landscape pages in a portrait-format document), 'Next Page' Section breaks are what are usually used to delineate the Sections.

    To get to the Section break insertion controls via the GUI in Word 2007 & later, go to Page Layout|Page Setup > Breaks.

    I don't know the C# code, but you'd use Word's InsertBreaks method. For example (in vba):
    Selection.InsertBreak Type:=wdSectionBreakContinuous

    The Type options for InsertBreak are:

    WdBreakType Enumeration

    Specifies type of break.

    Name Value Description
    wdColumnBreak 8 Column break at the insertion point.
    wdLineBreak 6 Line break.
    wdLineBreakClearLeft 9 Line break.
    wdLineBreakClearRight 10 Line break.
    wdPageBreak 7 Page break at the insertion point.
    wdSectionBreakContinuous 3 New section without a corresponding page break.
    wdSectionBreakEvenPage 4 Section break with the next section beginning on the next even-numbered page. If the section break falls on an even-numbered page, Word leaves the next odd-numbered page blank.
    wdSectionBreakNextPage 2 Section break on next page.
    wdSectionBreakOddPage 5 Section break with the next section beginning on the next odd-numbered page. If the section break falls on an odd-numbered page, Word leaves the next even-numbered page blank.
    wdTextWrappingBreak 11 Ends the current line and forces the text to continue below a picture, table, or other item. The text continues on the next blank line that does not contain a table aligned with the left or right

    Cheers
    Paul Edstein
    [MS MVP - Word]
    Tuesday, May 3, 2011 12:35 PM
  • Thank you that's what I need.
    Tuesday, May 3, 2011 2:04 PM