internal void MergeTextSize(System.Drawing.Graphics g, MacrosVerbCollection macrosVerbCollection) { foreach (SignRowTextBlock textBlock in this) { foreach (RowBlock block in textBlock) { block.MergeTextSize(g, macrosVerbCollection); } textBlock.ReInitTextInfo(); } }
internal MacrosVerbCollection SubVerbCollection(List <string> list) { MacrosVerbCollection subVerb = new MacrosVerbCollection(); foreach (KeyType entry in this.Keys) { if (list.Contains(entry.Key)) { subVerb[entry] = this[entry]; } } return(subVerb); }
/// <summary> /// 打印word /// </summary> public static void PrintWord(string filePath, MacrosVerbCollection macrosCollection) { Word.Application app = new Word.Application(); Word.Document doc = null; object collate = true; object item = Word.WdPrintOutItem.wdPrintDocumentContent; object missing = System.Reflection.Missing.Value; try { object path = filePath; doc = app.Documents.Add(ref path, ref missing, ref missing, ref missing); Replace(doc, macrosCollection); app = new Microsoft.Office.Interop.Word.ApplicationClass(); doc.PrintOut(ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref item, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing); } catch (Exception exp) { Function.Alert(exp.Message, "提示"); } finally { object saveChange = Microsoft.Office.Interop.Word.WdSaveOptions.wdDoNotSaveChanges; Word._Document _doc = doc as Word._Document; if (_doc != null) { _doc.Close(ref saveChange, ref missing, ref missing); } Word._Application _app = app as Word._Application; if (_app != null) { _app.Quit(ref missing, ref missing, ref missing); } } }
private static bool Replace(Word.Document oDoc, MacrosVerbCollection macrosCollection) { Word.Comment comment; Word.Range range; for (int i = oDoc.Comments.Count; i > 0; i--) { comment = oDoc.Comments[i]; KeyValuePair <string, int> key = new KeyValuePair <string, int>(comment.Range.Text, 1); if (macrosCollection.ContainsKey(key)) { range = comment.Scope; comment.Delete(); range.Text = macrosCollection[key]; object name = (object)key.Key; oDoc.Comments.Add(range, ref name); } } Word.View view = oDoc.Application.ActiveWindow.View; view.ShowComments = false; return(true); }
internal void MergeTextSize(System.Drawing.Graphics g, MacrosVerbCollection macrosVerbCollection) { if (EmptyBlock) { return; } if (text.IsIncludeMacros) { List <string> list = new List <string>(); foreach (string s in text.MacrosArgsName) { list.Add(macrosVerbCollection[s, 1]); } text.MacrosContext = list; } if (!string.IsNullOrEmpty(text.Context)) { SizeF sizef = g.MeasureString(text.Context, text.Attribute.Font); if (sizef.Width > (double)width) { width = Convert.ToInt32(sizef.Width); } } }