I have completed most of the processing for splitting a numbered paragraph. (I am doing this for a soft page break during an RTF export).
I do one page at a time. I copy the RVF text and then delete out the unneeded items (front and back). There are times that I have to split a paragraph (numbered and not) at the end of the page before doing the deletes. I have successfully done the split at the bottom of the page. The results accurately represent the PrintPreview text.
It is the top of the next page (continuation of the split text) that I am having a minor problem with. I accomplished the split by resetting SameAsPrev on the item and deleting off the preceeding text (up to the offset). The problem is that the text (on numbered paragraphs) is offset too much to the left when formatted. The formatted text starts where the number is instead of the where the actual text (after the paragraph number) begins. If I insert a leading tab into the text, the formatted text will start too far to the right. The ideal starting spot would be the middle of these two positions.
Do you have any ideas on how I can do this "simple procedure"?
Splitting a Numbered Paragraph
-
- Site Admin
- Posts: 17524
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
You will need to apply a new paragraph style (with modified indents) to the first paragraph on the page.
In bulleted&numbered paragraphs, FirstIndent and LeftIndent properties of the paragraph style are ignored, and properties (of the same name) of the list level are used. So you need to assign the property LeftIndent of the list level to the paragraph style's LeftIndent, and 0 to the paragraph style's FirstIndent.
PS: TRVPrint has SavePageAsRVF method, which saves some additional information allowing to display a part of document like the original page:
- displaying the first line with the proper indents, if it is a part of bulleted&numbered paragraph;
- displaying the last line with the proper spacing, if it is in justified paragraph
- displaying the proper numbers in numbered paragraphs.
In bulleted&numbered paragraphs, FirstIndent and LeftIndent properties of the paragraph style are ignored, and properties (of the same name) of the list level are used. So you need to assign the property LeftIndent of the list level to the paragraph style's LeftIndent, and 0 to the paragraph style's FirstIndent.
PS: TRVPrint has SavePageAsRVF method, which saves some additional information allowing to display a part of document like the original page:
- displaying the first line with the proper indents, if it is a part of bulleted&numbered paragraph;
- displaying the last line with the proper spacing, if it is in justified paragraph
- displaying the proper numbers in numbered paragraphs.
-
- Posts: 86
- Joined: Mon Jun 08, 2009 11:25 pm
I tried as you suggested and I cannot get it to work. ApplyParaStyle does not work. Here is my code. Maybe you can give me some idea where I am going wrong. This is in a function and I have passed in the item number and offset of where the break is to occur. I have omitted code that I know works (via debugger).
text = srve->RichViewEdit->GetItemText (item_number) + offset - 1;
srve->RichViewEdit->SetItemTextA (item_number, text);
para_num = SRichViewEdit->RichViewEdit->GetItemPara (item_number);
At this point I find the paragraph info (it is paragraph number 7). I then get the list information and adjust the information as suggested. I then look for a paragraph style with the same information. The lookup returns paragraph style number 8 (stored in index). I then finish the actions.
srve->RichViewEdit->GetItem (item_number)->SameAsPrev = false;
SRichViewEdit->Format ();
offset = srve->RichViewEdit->GetOffsBeforeItem (item_number);
srve->RichViewEdit->SetSelectionBounds (item_number, offset, item_number, offset);
A this point the CurParaStyleNo has a value of 6 and not like the value 7 I expected.
SRichViewEdit->RichViewEdit->ApplyParaStyle (index);
The above statement attempts to apply the new paragraph style (which has a value of 8 ) to the current paragraph. This statement does nothing. I should add that there is no paragraph protection or any other paragraph options set for this processing.
Thanks for any help you can give.
text = srve->RichViewEdit->GetItemText (item_number) + offset - 1;
srve->RichViewEdit->SetItemTextA (item_number, text);
para_num = SRichViewEdit->RichViewEdit->GetItemPara (item_number);
At this point I find the paragraph info (it is paragraph number 7). I then get the list information and adjust the information as suggested. I then look for a paragraph style with the same information. The lookup returns paragraph style number 8 (stored in index). I then finish the actions.
srve->RichViewEdit->GetItem (item_number)->SameAsPrev = false;
SRichViewEdit->Format ();
offset = srve->RichViewEdit->GetOffsBeforeItem (item_number);
srve->RichViewEdit->SetSelectionBounds (item_number, offset, item_number, offset);
A this point the CurParaStyleNo has a value of 6 and not like the value 7 I expected.
SRichViewEdit->RichViewEdit->ApplyParaStyle (index);
The above statement attempts to apply the new paragraph style (which has a value of 8 ) to the current paragraph. This statement does nothing. I should add that there is no paragraph protection or any other paragraph options set for this processing.
Thanks for any help you can give.
-
- Site Admin
- Posts: 17524
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: