Is it possible to delete line/para using SetSelectionBounds+DeleteSelection instead of DeleteItems+Format/DeleteParas?
I use DeleteItems and sometimes I get exception during the Format execution. I guess the cause is that document is incorrect.
Deletion line/para
-
- Site Admin
- Posts: 17560
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Yes, DeleteItems may create invalid document (see http://www.trichview.com/help/valid_documents.html ).
However, if you use DeleteParas, it should be safe.
You can use SetSelectionBounds+DeleteSelection. Note that
- this operation is undoable; if you will use it in combination with non-undoable operations, the undo buffer will contain invalid data, and you need to clear it using ClearUndo;
- to delete the paragraphs from the M to N, y need to select either from the end of the paragraph M-1 to the end of the paragraph N, or from the beginning of the paragraph M to the beginning of the paragraph N+1.
If you select from the beginning of M to the end of N, DeleteSelection will produce an empty line in the place of deletion.
However, if you use DeleteParas, it should be safe.
You can use SetSelectionBounds+DeleteSelection. Note that
- this operation is undoable; if you will use it in combination with non-undoable operations, the undo buffer will contain invalid data, and you need to clear it using ClearUndo;
- to delete the paragraphs from the M to N, y need to select either from the end of the paragraph M-1 to the end of the paragraph N, or from the beginning of the paragraph M to the beginning of the paragraph N+1.
If you select from the beginning of M to the end of N, DeleteSelection will produce an empty line in the place of deletion.
Thanks! I've tried to do like this
and it works properly!
Code: Select all
RVData.SetSelectionBounds(FirstItemNo, RVData.GetOffsBeforeItem(FirstItemNo), LastItemNo + 1, RVData.GetOffsBeforeItem(LastItemNo + 1));
FRVE.DeleteSelection;
-
- Site Admin
- Posts: 17560
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: