Free Support Forum - aspose.com

Paragraph with page break & picture in paragraph

Hi, I have 2 problems:

#1. Is it possible to know when a paragraph belong to 2 different pages? I saw the getKeepTogether property of getParagraphFormat() but it don´t resolve my question.

#2. When a paragraph has an image that is square with text, How I can to know the left indent of these lines? E.g: (x = image, a = text)

XXXaaaaa
XXXaaaaa
aaaaaaaaaa
aaaaaaaaaa


Sorry about my English and thanks.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your interest in Aspose.Words.

As you may know MS Word document is flow document and does not contain any information about its layout into lines and pages. Technically there is no “Page” and “Line” concept in Word document. Our Rendering Engine layouts documents into lines and pages. But unfortunately, there is no public API, which allows you to determine where page starts or ends. Also, there is no way to find the position of the particular node on page. Your request has been linked to the appropriate issue. You will be notified as soon as this feature is supported.

Regarding the second questions, if I understand you correctly, I think you can try calculating this value using shape.getSizeInPoints() and doc.getFirstSection().getPageSetup().getPageWidth();

Best regards,

Hi,

Any progress on that? I’m tring to find out at least on which page paragraph starts.

Regards
Jacek

Hello

Thanks for your inquiry. At the moment this issue is pending for analysis. The responsible developer will analyze the issue and I will be able to provide you an estimate.

Best regards,

Hi Jacek,


Thanks for your inquiry.

In the mean time you can use the simple code below to find the page numbers of the start and end of a paragraph.

<span style=“font-size:
10.0pt;font-family:“Courier New”;color:#2B91AF;mso-no-proof:yes”>Document<span style=“font-size:10.0pt;font-family:“Courier New”;mso-no-proof:yes”> doc = new Document();<o:p></o:p>

DocumentBuilder builder = new DocumentBuilder(doc);

// Build a sample paragraph which spans across two pages.

builder.Write("Text on first page ");

builder.InsertBreak(BreakType.PageBreak);

builder.Write("Text on second page");

Paragraph firstParagraph = doc.FirstSection.Body.FirstParagraph;

// Move to the beginning of the paragraph.

builder.MoveTo(firstParagraph.FirstChild);

Field firstPageField = builder.InsertField("PAGE", "");

// Move to the end of the paragraph.

builder.MoveTo(firstParagraph.LastChild);

Field lastPageField = builder.InsertField("PAGE", "");

doc.UpdateFields();

// Parse the page numbers of the start and end of the paragraph.

int startingPage = int.Parse(firstPageField.Result);

int endingPage = int.Parse(lastPageField.Result);

// Remove the fields.

firstPageField.Remove();

lastPageField.Remove();


If you have any further queries, please feel free to ask.

Thanks,

The issues you have found earlier (filed as WORDSNET-2978) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(45)

The issues you have found earlier (filed as WORDSNET-2978) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.