Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-04-2017, 12:26 AM
MANOHAR MANOHAR is offline page breaks Insertion Windows 7 32bit page breaks Insertion Office 2007
Advanced Beginner
page breaks Insertion
 
Join Date: Jan 2017
Posts: 33
MANOHAR is on a distinguished road
Default page breaks Insertion

Hello,



Is there a way to insert pagebreaks to all pages using macro or word object model?

I need this because we are see some soft page breaks missing when opened using OPENXML sdk.

Regards
Manohar
Reply With Quote
  #2  
Old 01-04-2017, 01:36 AM
macropod's Avatar
macropod macropod is offline page breaks Insertion Windows 7 64bit page breaks Insertion Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Inserting manual page breaks is certainly possible but doing so has adverse effects:
1. It splits paragraphs in two, which will cause an auto-numbered paragraph to become two sequentially-auto-numbered paragraphs.
2. It splits tables in two, which can be disastrous for tables using header rows to populate multiple pages - it also messes with cells that span page breaks.
3. It prevents Word from re-flowing the document content properly when opened on a computer using a different print driver to the one on which the page breaks were created. This can result on a new page being created with just one or two lines of text (containing as few as a single word) and/or other pages not being filled (having just a few words (if any) on the last available line for a paragraph that continues on the next page.
I'm sure other contributors here can list more adverse effects, too - the above spring readily to mind.

I'm not sure what you mean by "some soft page breaks missing" - soft page breaks, as such, don't exist in a Word document - they're nothing more than a display construct that shifts around while the document is open in response to edits.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 01-04-2017, 07:49 AM
Charles Kenyon Charles Kenyon is offline page breaks Insertion Windows 10 page breaks Insertion Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,138
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Chiming in to agree that manual page breaks make for documents that are extremely difficult to edit. What are you trying to accomplish with the page breaks?
Reply With Quote
  #4  
Old 01-04-2017, 10:27 AM
MANOHAR MANOHAR is offline page breaks Insertion Windows 7 32bit page breaks Insertion Office 2007
Advanced Beginner
page breaks Insertion
 
Join Date: Jan 2017
Posts: 33
MANOHAR is on a distinguished road
Default

Our Goal is to convert a word document to some other format. We do this by the help of wordOpenXml property in the interop and openxml sdk. everything is working well so far but we have observed that some of the page breaks have been missed out in the wordOpenXml property output. for example : when the first paragraph is empty.

Can we mark the end of page or last character of a page with a bookmark or something, so that when we read that element from wordOpenXml we can consider it as a page break? if yes, how can we do it using macro.
Reply With Quote
  #5  
Old 01-04-2017, 11:57 AM
macropod's Avatar
macropod macropod is offline page breaks Insertion Windows 7 64bit page breaks Insertion Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

All word-processors use a pagination approach analogous to Word's. Unless you're converting to a format used by a page layout program (e.g. one that produces PDFs - which Word can do on its own), there is nothing to be gained (and much to lose) by inserting such page breaks. Besides which, how do you propose to handle issues such as those I outlined?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 01-04-2017, 07:04 PM
MANOHAR MANOHAR is offline page breaks Insertion Windows 7 32bit page breaks Insertion Office 2007
Advanced Beginner
page breaks Insertion
 
Join Date: Jan 2017
Posts: 33
MANOHAR is on a distinguished road
Default

We are converting to txt format. So we don't have to worry about other effects.

Can we mark the end of page or last character of a page with a bookmark or something, so that when we read that element from wordOpenXml we can consider it as a page break? if yes, how can we do it using macro.

Thanks
Manohar
Reply With Quote
  #7  
Old 01-04-2017, 10:29 PM
macropod's Avatar
macropod macropod is offline page breaks Insertion Windows 7 64bit page breaks Insertion Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Bookmarks won't survive conversion to text format. Your only option would be to insert a character or string that you can parse into a page break for wordOpenXml purposes. Indeed, if you know what the wordOpenXml code is for that, you might even be able to insert that code directly into the document.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #8  
Old 01-05-2017, 01:12 AM
MANOHAR MANOHAR is offline page breaks Insertion Windows 7 32bit page breaks Insertion Office 2007
Advanced Beginner
page breaks Insertion
 
Join Date: Jan 2017
Posts: 33
MANOHAR is on a distinguished road
Default

Thanks Paul, But how can we find the last character of the page?
Reply With Quote
  #9  
Old 01-05-2017, 02:04 AM
macropod's Avatar
macropod macropod is offline page breaks Insertion Windows 7 64bit page breaks Insertion Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The following macro inserts prefixes every page with <pg> and ends it with </pg>
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim i As Long
With ActiveDocument
  For i = .ComputeStatistics(wdStatisticPages) To 2 Step -1
    .GoTo(What:=wdGoToPage, Name:=i).InsertBefore "</pg><pg>"
  Next
  .Range.InsertBefore "<pg>"
  .Range.InsertAfter "</pg>"
End With
Application.ScreenUpdating = True
End Sub
Note that the code works backwards through the document, so that its own additions don't disturb the locations of the original page breaks.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
page breaks Insertion Configured page size to 20 inches height : why the page still breaks @ the default 9,6” ? Ron Wolpa Word 4 08-18-2016 06:43 PM
Subdocuments without Page Breaks? titani2 Word 8 08-26-2014 05:58 AM
page breaks Insertion Hidden page breaks and section breaks jrasicmark Word 3 06-02-2014 11:28 PM
page breaks Insertion Page breaks and page numbering sfteam Word 3 06-06-2013 11:56 PM
Deleted Section Breaks Changes Page Breaks Brantnshellie Word 0 02-01-2009 09:22 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:44 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft