static void AddWordFirstPageImgge() { FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog(); if (folderBrowserDialog.ShowDialog() != DialogResult.OK) { return; } string strFolder = folderBrowserDialog.SelectedPath; var application = GetWordApplication(); int i = 0; var folders = Directory.GetDirectories(strFolder); foreach (string folder in folders) { i++; string strWord = Directory.GetFiles(folder).Where(f => f.Contains(".doc")).First(); string strImage = Directory.GetFiles(folder).Where(f => f.Contains(".jpg") || f.Contains(".png")).First(); Document doc = application.Documents.Open(strWord); doc.ActiveWindow.Selection.InsertBreak(WdBreakType.wdPageBreak); doc.ActiveWindow.Selection.GoTo(WdGoToItem.wdGoToPage, WdGoToDirection.wdGoToFirst); NetOffice.WordApi.Shape shape = doc.Shapes.AddPicture(strImage); shape.WrapFormat.Type = WdWrapType.wdWrapBehind; shape.Left = -91.0f; shape.Top = -72.75f; shape.Width = 596.25f; shape.Height = 840.75f; doc.Save(); doc.Close(); Thread.Sleep(200); Console.WriteLine($"{i}/{folders.Length}"); } }
public virtual void EndConnect(out NetOffice.WordApi.Shape connectedShape, Int32 connectionSite) { ParameterModifier[] modifiers = Invoker.CreateParamModifiers(true, false); connectedShape = null; object[] paramsArray = Invoker.ValidateParamsArray(connectedShape, connectionSite); InvokerService.InvokeInternal.ExecuteMethod(this, "EndConnect", paramsArray, modifiers); if (paramsArray[0] is MarshalByRefObject) { connectedShape = Factory.CreateKnownObjectFromComProxy <NetOffice.WordApi.Shape>(this, paramsArray[0], typeof(NetOffice.WordApi.Shape)); } else { connectedShape = null; } }
public bool Q5() { if (this.Document.Content.ShapeRange.Count == 0) { return(false); } float maxTop = 25f; OWord.Shape shape = this.Document.Content.ShapeRange.First <OWord.Shape>(); return(shape.WrapFormat.Type == OWord.Enums.WdWrapType.wdWrapTight && shape.Type == NetOffice.OfficeApi.Enums.MsoShapeType.msoPicture && shape.Top <= maxTop && shape.Left <= 0); ; }
public WordTags(Word.Shape shape) { this.element = shape; }
public bool Q5() { OWord.Shape shape = this.Document.Content.ShapeRange.Last <OWord.Shape>(); return(shape.SoftEdge.Type == NetOffice.OfficeApi.Enums.MsoSoftEdgeType.msoSoftEdgeTypeNone && shape.SoftEdge.Radius == 8.858268f); }