Hello,
I need to remove all empty pages of the document which content is auto-generated.
I also tried to use your code snippet which is suggested on your website but I had to extend it.
The method looks like this right now:
So I also check if there are only empty lines on a page and try to remove them.
But removing these lines doesn't seem to work.
For example I've got a page with two empty lines which are selected correctly.
When I try to set the selected text to a empty string (BausteinTextControl.Selection.Text = "";) nothing happens to the selected text.
What could be the reason for that behaviour?
If you need further information please tell me.
I need to remove all empty pages of the document which content is auto-generated.
I also tried to use your code snippet which is suggested on your website but I had to extend it.
The method looks like this right now:
Code:
TXTextControl.PageCollection.PageEnumerator pageEnum = BausteinTextControl.GetPages().GetEnumerator();
pageEnum.MoveNext();
int pageCounter = BausteinTextControl.GetPages().Count;
for (int i = 0; i < pageCounter; i++)
{
TXTextControl.Page curPage = (TXTextControl.Page)pageEnum.Current;
if (curPage.Length == 1)
{
BausteinTextControl.Select(curPage.Start - 1, 1);
BausteinTextControl.Selection.Text = "";
}
else if (curPage.Length > 1)
{
curPage.Select();
if (BausteinTextControl.Selection.Text.Replace("\r\n", "").Trim().Length == 0)
{
BausteinTextControl.Select(curPage.Start - 1, curPage.Length);
BausteinTextControl.Selection.Text = "";
}
else
pageEnum.MoveNext();
}
else
pageEnum.MoveNext();
}
But removing these lines doesn't seem to work.
For example I've got a page with two empty lines which are selected correctly.
When I try to set the selected text to a empty string (BausteinTextControl.Selection.Text = "";) nothing happens to the selected text.
What could be the reason for that behaviour?
If you need further information please tell me.