Shortly speaking:
this line:
doc.InlineShapes.AddOLEObject("Excel.Chart.8");
opens Excel. How to disable this?
more details:
I am trying to create docx documents from a template with a Word2010 script in C #. I open the document this way:
Word.Document doc = app.Documents.Open(@"xxxx.docx",Visible:false);
Word2010 does not appear during script, but Excel2010 does this when I create a chart inside a word document ("Excel.Chart.8")
I see the whole process of creating charts on my monitor, which I do not want.
Is there a way to hide Excel2010 (Chart Tools) during the process?
edit: Example of creating an excel chart:
Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application();
Word.Document doc = app.Documents.Open(@"xxxx.docx",Visible:false);
string classtype = "Excel.Chart.8";
Bookmark shapeBookMark = doc.Bookmarks.get_Item("mybookmark");
Word.InlineShape wrdInlineShape = doc.InlineShapes.AddOLEObject(classtype, Range: shapeBookMark.Range);
if (wrdInlineShape.OLEFormat.ProgID == classtype)
{
object verb = Word.WdOLEVerb.wdOLEVerbHide;
wrdInlineShape.OLEFormat.DoVerb(ref verb);
Excel.Workbook obook = (Excel.Workbook)wrdInlineShape.OLEFormat.Object;
Excel.Worksheet sheet = (Excel.Worksheet)obook.Worksheets["Sheet1"];
((Microsoft.Office.Interop.Excel.Range)sheet.Cells[1, 1]).Value = "data";
}
, Visible: false, excel, word. , , (, 16 /docx)