S
stocki
Hi Everybody,
one of my C# apps copies charts from an Excel workbook into a table in
a word document.
((Excel.ChartObject) myGraphicsWorksheet.ChartObjects(1)).Copy();
myvalue = Word.WdPasteDataType.wdPasteMetafilePicture;
myOutRange.PasteSpecial( ref mymissingValue, ref mymissingValue, ref
mymissingValue, ref mymissingValue, ref myvalue, ref mymissingValue,
ref mymissingValue );
Afterwards I am going to position the graph within the respective table
cell:
object shapeCount = m_wordDoc.Shapes.Count;
myShape = m_wordDoc.Shapes.Item( ref shapeCount );
myShape.Left = graphPos
For the most of the documents this works perfect. If the document is
bigger the application stumbels when trying to set the left property of
the shape. I ran the whole lot in the development environment setting a
breakpoint onto the line with the left property. When the breakpoint
was reached I waited a little while. When pressing the F10 key to go
ahead, everything worked fine. When I toggled the breakpoint the
problem occured again.
My impression is that Word still is doing some work, when the app tries
to set the left property. The error message is something like "Can't
set the left property because the paint command does not exist for the
current selection" (or something like that)
Has anyone an idea to get around this problem? Tried it with DoEvents
and ThreadSleep without any luck ...
Cheers
Stocki
one of my C# apps copies charts from an Excel workbook into a table in
a word document.
((Excel.ChartObject) myGraphicsWorksheet.ChartObjects(1)).Copy();
myvalue = Word.WdPasteDataType.wdPasteMetafilePicture;
myOutRange.PasteSpecial( ref mymissingValue, ref mymissingValue, ref
mymissingValue, ref mymissingValue, ref myvalue, ref mymissingValue,
ref mymissingValue );
Afterwards I am going to position the graph within the respective table
cell:
object shapeCount = m_wordDoc.Shapes.Count;
myShape = m_wordDoc.Shapes.Item( ref shapeCount );
myShape.Left = graphPos
For the most of the documents this works perfect. If the document is
bigger the application stumbels when trying to set the left property of
the shape. I ran the whole lot in the development environment setting a
breakpoint onto the line with the left property. When the breakpoint
was reached I waited a little while. When pressing the F10 key to go
ahead, everything worked fine. When I toggled the breakpoint the
problem occured again.
My impression is that Word still is doing some work, when the app tries
to set the left property. The error message is something like "Can't
set the left property because the paint command does not exist for the
current selection" (or something like that)
Has anyone an idea to get around this problem? Tried it with DoEvents
and ThreadSleep without any luck ...
Cheers
Stocki