[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

rtf: page breaks 2

Posted on 2011-02-22
2
Medium Priority
?
272 Views
Last Modified: 2012-05-11
Dear experts,

I have an c++ application that converts .rtf files into another custom format. One of the requirements is to preserve page separation of the text. I understand that .rtf doesn't know about page breaks unless they are inserted explicitly. But still MS Word divides the text into pages based I think on its page settings. Could you please tell me if I can programmatically fetch those settings to use them for calculating where the page breaks should be?
Thanks.
0
Comment
Question by:tantormedia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 34959432

In the absence of specific (manual) page breaks, Word will start to print a new page when the current page is full. This can also be seen on the screen in 'Print Layout' view. However, there is nothing in the Word document file to mark the position; it is recalculated dynamically. This is because the exact position could change according to which print driver and which font versions are being used.

This means that you must use the Word application to find out where it would break the page when printing in the current environment. There are methods in the Word object model to find the position. Here are a couple of examples in Word VBA code.
Sub FindPage23()
    Dim rng As Range
    '(rng.GoTo, though documented, doesn't work)
    Selection.GoTo wdGoToPage, wdGoToAbsolute, 23 
    Set rng = Selection.Range
End Sub

Function GetPageNumber(rng As Range) As Integer
    GetPageNumber = rng.Information(wdActiveEndPageNumber)
End Function

Open in new window

0
 

Author Comment

by:tantormedia
ID: 34961983
Thank you very much. Couldn't you please refer me to some solutions in C++?
I guess all I need is the number of lines on a page based on the current environment.
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Cancel future meetings from user mailboxes in Office 365 using Remove-CalendarEvents
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question