internal static void CreateLine <T>(this T lc, MWord.Range range, WdOMathJc justify = WdOMathJc.wdOMathJcLeft, int fontsize = 12, int leftIndent = 0, int spaceAfter = 0, int bold = 0) where T : LineContent { switch (lc) { case LineText lt: lt.WriteLine(range, justify, fontsize, leftIndent * (int)lc.TabIndex, spaceAfter, bold); break; case LineTable lta: lta.WriteLine(range, fontsize); break; case LinePicture lp: lp.WriteLine(range); break; case LineCanvas ls: ls.WriteLine(range); break; case CurveCanvasShape ccs: ccs.DrawShapeOnDoc(range.Document); break; case LineCanvasShape lcs: lcs.DrawShapeOnDoc(range.Document); break; case TriangleCanvasShape tcs: tcs.DrawShapeOnDoc(range.Document); break; } range.InsertParagraphAfter(); }
private static void WriteLine(this LineText lt, MWord.Range range, WdOMathJc justify = WdOMathJc.wdOMathJcLeft, int fontsize = 12, int leftIndent = 0, int spaceAfter = 0, int bold = 0) { if ((lt.TextContent == null) || (lt.TextContent?.Length == 0)) { return; } range.Text = lt.TextContent; var mathRange = range.OMaths.Add(range); var currentMath = mathRange.OMaths[1]; currentMath.Range.Font.Bold = bold; currentMath.Range.Font.Size = fontsize; currentMath.Justification = justify; currentMath.BuildUp(); currentMath.Range.Paragraphs.LeftIndent = leftIndent; currentMath.Range.Paragraphs.SpaceAfter = spaceAfter; range.InsertParagraphAfter(); }