Word文档中有一些excel.workbooks。
我可以获得Word.Inline形状,但我需要将它们转换为Excel.Application
Word.InlineShapes shapes=wordApp.ActiveDocument.InlineShapes;
通过
创建的那些形状wordApp.Selection.InlineShapes.AddOLEObject("MSGraph.Chart.8", excellApp.ActiveWorkbook.Name, false, false, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
如何将它们再次转换为Excel.Workbook?
我也试过;
Word.InlineShapes shapes = wordApp.ActiveDocument.InlineShapes;
foreach(Word.Shape shape in shapes)
{
Word.Chart chart = shape.Chart;
}
但它会抛出未实现的异常。
答案 0 :(得分:1)
试试这个:
Word.OLEFormat ole = shape.OLEFormat;
ole.Activate();
Excel.Workbook book = (Excel.Workbook)ole.Object;