Page break inserts black page

  • Julian,

    We're getting a problem with wpRichText, when inserting a page. We have a document, currently about 3 pages, that has a lot of tables on it.

    When you insert a page break, from without a table, it inserts a black page and eventually crashes. The document already has two page breaks in it.

    I am using wpRichText1.inputString(#12) to insert the page breaks. There's no other code involved.

    Any idea what might be causing this. Unfortunately, it is rather urgent that we resolve this problem.

    Thanks,

    Mark.

  • Thanks Julian,

    I've tried this and it works fine, except it doesn't update the page until you activate the richText. I tried update, but that did nothing. So I enclosed the statement in a LockScreen statement. This works, but there is a bit of a delay. What's the best way to get an automatic update?

    Cheers

    Mark

  • Hi Julian,

    Thanks for the response.

    I've tried refresh, it updates the wpRichText but it is still slow.

    I've had a look at the rtfcodes and the code for a page break is identical whether you use inputstring(#12) or FastSetPageBreak. InputString(#12) is much faster.

    Also, we are still getting black pages. We've got a big demo on Tuesday. If we are still getting black pages this could cause us a real problem. Any idea what might be causing this. It does not happen always, but when it does happen it seems to be the same pages that are black and obviously you cannot read the black text that is on them. If you change the text color to white or select the page then you can see the text.

    I assumed that somehow the wpRichText1.color's property was being affected, but I have tested it and the white pages have the same color code as the black ones, but I should have realised this. Changing this property would have changed the color for all pages not just the black ones and when you scroll up and down and have a black and white page in view at the same time, you can see that one is white and the other is black.

    Do you have any idea what could be causing this problem. It's driving me bananas. What object's properties could be affecting the whole background color of one page whilst not affecting the background color of another?

    Thanks,

    Mark

  • I've found out what is causing the problem although I don't know why.

    It is the canvas that is being painted as black. In onPaintPage I reset the canvas to white and this seems to sort it out okay. But if you have any ideas what is causing this behaviour I would be grateful.

    Also, I sometimes add images to the canvas. These are applied to each page with precisely the same code. On some pages they seem to work okay on others they are distorted. Any ideas what might be causing this?

    Thanks

    Mark

    • Offizieller Beitrag

    Ok, you mean a 'black' page not a 'blank' page - I got that completely wrong.

    If the canvas is filled with black it can because by error during painting - for an example a super large character. This can happen when the resolution is not picked up correctly.

    I can only debug this with a test project - usually I then try to change the color to something else, such as clRed to make it visible if the filling is done or not.

    The big question is wher the cursor is when you insert tzhe page break. I would rather try to use InputString('@PAGE') and then check wher this goes.

    It would be best if this is the first colum of a table.

    Julian