将Word.InlineShape转换为Excel.Workbook c#
在Word文档中有一些excel.workbooks。
我可以得到Word.Inline形状,但我需要将它们转换为Excel.Application
Word.InlineShapes shapes=wordApp.ActiveDocument.InlineShapes;
那些形状通过创build
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; }
但它抛出未实现的exception。
尝试这个:
Word.OLEFormat ole = shape.OLEFormat; ole.Activate(); Excel.Workbook book = (Excel.Workbook)ole.Object;