[IronPython] FlowDocument problem...

Don Sawatzky donsaw at comcast.net
Sat Feb 27 15:27:19 CET 2010

I have a FlowDocument as a visual in a RichTextBox that I want to print.  However, I want to print the visual with different page attributes.  So, I tried the most IronPythonic way.

            printFlowDocument = FlowDocument(); etc.....
            printFlowDocument.Blocks = visualFlowDocument.Blocks  # Won't work because Blocks is read-only attribute

This way works fine:
            visualflowDoc = richTextBox.Document
            printFlowDoc.Blocks.Add(visualflowDoc.Blocks.LastBlock) # Visual disappears
            visualFlowDoc.Blocks.Add(printFlowDoc.Blocks.LastBlock) # Visual reappears

The Add method of Blocks, which is a Collection, acts as a "copy and delete", and I hoped it would act as a Python "list.append".  I wonder if there is a more IronPythonic way to do this or if .Net Collection is not broadly wrapped by Python list.  I know that getitem, setitem, and iteration work.

donsaw at comcast.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100227/97d87687/attachment.html>

More information about the Ironpython-users mailing list