OwnerPrintDraw function misses cell content in preview mode

Posted by: Peter.Priestley on 17 September 2025, 4:22 am EST

    • Post Options:
    • Link

    Posted 17 September 2025, 4:22 am EST - Updated 17 September 2025, 4:27 am EST

    To cut a long story short, we have implemented Print and Print Preview in a C++/MFC application using the method fpSpread1->OwnerPrintDraw.

    This worked fine with Spread 13, producing Print Preview output like this:

    After porting to Spread 18, Print Preview output looks like this with the cell contents missing.

    Note that it is a Print Preview issue only. Printing on an actual printer works fine with either version and the cell contents are visible.

    Can you throw any light on this? Do I need some configuration in the PrintInfo object? Unfortunately there don’t seem to be any examples of using OwnerPrintDraw with Spread 18.

    Thanks,

    Peter.

  • Posted 17 September 2025, 7:52 am EST - Updated 17 September 2025, 7:58 am EST

    Hi Peter,

    Spread.NET does not officially support C++/CLI. To test your case, we created a WinForms sample based on your description, but we could not reproduce the issue. The cell entries appeared correctly in the preview (see screenshot below):

    We have attached the sample project for your reference: OwnerPrintDrawDemo.zip

    Could you please update this sample to reflect your exact scenario? That will help us investigate the issue further and provide you with a more appropriate solution.

    Thanks & regards,

    Aastha

  • Posted 5 October 2025, 9:58 pm EST

    Thanks.

    The Dotnet printing code works ok for both Print Preview and Printing. I cannot find any mods that cause it not to work.

    However I am using the MFC printing framework which does not work for Print Preview. The difference seems to be that for MFC the Graphics object (for Print Preview) is based on a screen DC; while in Dotnet the Graphics object is always based on a printer DC (with some additional magic to reflect that to the screen?? - not really sure - but by debugging I can see that the Print Preview Device Context has the characteristics of my default printer rather than the screen).

    So OwnerDrawPrint doesn’t fully support a screen DC any more.

    It is frustrating that most of my questions get batted away with “not supporting C++/CLI”.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels