/// <summary> /// Copy the pargraph format's settings into the target paragraph format. /// </summary> /// <param name="format">The paragraph format to copy settings from.</param> /// <param name="target">The paragraph format to copy settings to.</param> public static void CopyTo(this ParagraphFormat format, ParagraphFormat target) { if (ReferenceEquals(format, target)) return; target.Alignment = format.Alignment; target.Bidi = format.Bidi; target.FirstLineIndent = format.FirstLineIndent; target.KeepTogether = format.KeepTogether; target.KeepWithNext = format.KeepWithNext; target.LeftIndent = format.LeftIndent; target.LineSpacing = format.LineSpacing; target.LineSpacingRule = format.LineSpacingRule; target.NoSpaceBetweenParagraphsOfSameStyle = format.NoSpaceBetweenParagraphsOfSameStyle; target.OutlineLevel = format.OutlineLevel; target.PageBreakBefore = format.PageBreakBefore; target.RightIndent = format.RightIndent; target.SpaceAfter = format.SpaceAfter; target.SpaceAfterAuto = format.SpaceAfterAuto; target.SpaceBefore = format.SpaceBefore; target.SpaceBeforeAuto = format.SpaceBeforeAuto; var style = target.Style.Styles[format.Style.Name]; if (style != null) target.Style = style; target.SuppressAutoHyphens = format.SuppressAutoHyphens; target.WidowControl = format.WidowControl; }
void FormatBibliographyParagraph(ParagraphFormat format) { format.Reset(); format.FirstLineIndent = 0; format.LeftIndent = 0; if (bibliographyResult.HangingIndent) { format.TabHangingIndent(1); } else { var isMarginAlign = bibliographyResult.SecondFieldAlign == "margin"; var isFlushAlign = bibliographyResult.SecondFieldAlign == "flush"; if (isFlushAlign || isMarginAlign) { var tabOffset = 4 + 6 * bibliographyResult.MaxOffset; // Use a tab to set the hanging indent // then remove it format.TabStops.Add(tabOffset); format.TabHangingIndent(1); format.TabStops.ClearAll(); if (isMarginAlign) { format.FirstLineIndent -= tabOffset; format.LeftIndent -= tabOffset; } } } //if (bibliographyResult.LineSpacing != 1) //{ format.LineSpacingRule = WdLineSpacing.wdLineSpaceMultiple; format.LineSpacing = format.Application.LinesToPoints(bibliographyResult.LineSpacing); //} format.SpaceAfter = format.LineSpacing * bibliographyResult.EntrySpacing; }
protected void FlattenParagraphFormat(ParagraphFormat format, ParagraphFormat refFormat) { if (format._alignment.IsNull) format._alignment = refFormat._alignment; if (format._firstLineIndent.IsNull) format._firstLineIndent = refFormat._firstLineIndent; if (format._leftIndent.IsNull) format._leftIndent = refFormat._leftIndent; if (format._rightIndent.IsNull) format._rightIndent = refFormat._rightIndent; if (format._spaceBefore.IsNull) format._spaceBefore = refFormat._spaceBefore; if (format._spaceAfter.IsNull) format._spaceAfter = refFormat._spaceAfter; if (format._lineSpacingRule.IsNull) format._lineSpacingRule = refFormat._lineSpacingRule; if (format._lineSpacing.IsNull) format._lineSpacing = refFormat._lineSpacing; if (format._widowControl.IsNull) format._widowControl = refFormat._widowControl; if (format._keepTogether.IsNull) format._keepTogether = refFormat._keepTogether; if (format._keepWithNext.IsNull) format._keepWithNext = refFormat._keepWithNext; if (format._pageBreakBefore.IsNull) format._pageBreakBefore = refFormat._pageBreakBefore; if (format._outlineLevel.IsNull) format._outlineLevel = refFormat._outlineLevel; if (format._font == null) { if (refFormat._font != null) { //The font is cloned here to avoid parent problems format._font = refFormat._font.Clone(); format._font._parent = format; } } else if (refFormat._font != null) FlattenFont(format._font, refFormat._font); if (format._shading == null) { if (refFormat._shading != null) { format._shading = refFormat._shading.Clone(); format._shading._parent = format; } //format.shading = refFormat.shading; } else if (refFormat._shading != null) FlattenShading(format._shading, refFormat._shading); if (format._borders == null) format._borders = refFormat._borders; else if (refFormat._borders != null) FlattenBorders(format._borders, refFormat._borders); //if (format.tabStops == null) // format.tabStops = refFormat.tabStops; if (refFormat._tabStops != null) FlattenTabStops(format.TabStops, refFormat._tabStops); if (refFormat._listInfo != null) FlattenListInfo(format.ListInfo, refFormat._listInfo); }
internal virtual void VisitParagraphFormat(ParagraphFormat paragraphFormat) { }
private void method_1(Paragraph A_0, ParagraphFormat A_1) { if (A_0 == null) { return; } if (A_1.method_31(0x3e8) == null) { goto Label_00B8; } int num2 = (int)A_1.method_31(0x3e8); string str2 = string.Empty; using (Dictionary <string, int> .Enumerator enumerator2 = this.class764_0.method_47().GetEnumerator()) { KeyValuePair <string, int> current; while (enumerator2.MoveNext()) { current = enumerator2.Current; if (current.Value == num2) { goto Label_0065; } } goto Label_007E; Label_0065: str2 = current.Key; } Label_007E: if (this.document_0.StyleNameIds.ContainsValue(str2)) { IParagraphStyle style2 = this.document_0.Styles.FindByName(str2, StyleType.ParagraphStyle) as IParagraphStyle; if (style2 != null) { A_0.method_65(style2); } } Label_00B8: if ((A_1.FormatRevision == null) || (A_1.FormatRevision.method_4().method_31(0x3e8) == null)) { return; } int num = (int)A_1.FormatRevision.method_4().method_31(0x3e8); string str = string.Empty; using (Dictionary <string, int> .Enumerator enumerator = this.class764_0.method_47().GetEnumerator()) { KeyValuePair <string, int> pair; while (enumerator.MoveNext()) { pair = enumerator.Current; if (pair.Value == num) { goto Label_0131; } } goto Label_0149; Label_0131: str = pair.Key; } Label_0149: if (this.document_0.StyleNameIds.ContainsValue(str)) { IParagraphStyle style = this.document_0.Styles.FindByName(str, StyleType.ParagraphStyle) as IParagraphStyle; if (style != null) { A_1.FormatRevision.method_4().ApplyBase(style.ParagraphFormat); } } }
protected void FlattenParagraphFormat(ParagraphFormat format, ParagraphFormat refFormat) { if (format._alignment.IsNull) { format._alignment = refFormat._alignment; } if (format._firstLineIndent.IsNull) { format._firstLineIndent = refFormat._firstLineIndent; } if (format._leftIndent.IsNull) { format._leftIndent = refFormat._leftIndent; } if (format._rightIndent.IsNull) { format._rightIndent = refFormat._rightIndent; } if (format._spaceBefore.IsNull) { format._spaceBefore = refFormat._spaceBefore; } if (format._spaceAfter.IsNull) { format._spaceAfter = refFormat._spaceAfter; } if (format._lineSpacingRule.IsNull) { format._lineSpacingRule = refFormat._lineSpacingRule; } if (format._lineSpacing.IsNull) { format._lineSpacing = refFormat._lineSpacing; } if (format._widowControl.IsNull) { format._widowControl = refFormat._widowControl; } if (format._keepTogether.IsNull) { format._keepTogether = refFormat._keepTogether; } if (format._keepWithNext.IsNull) { format._keepWithNext = refFormat._keepWithNext; } if (format._pageBreakBefore.IsNull) { format._pageBreakBefore = refFormat._pageBreakBefore; } if (format._outlineLevel.IsNull) { format._outlineLevel = refFormat._outlineLevel; } if (format._font == null) { if (refFormat._font != null) { //The font is cloned here to avoid parent problems format._font = refFormat._font.Clone(); format._font._parent = format; } } else if (refFormat._font != null) { FlattenFont(format._font, refFormat._font); } if (format._shading == null) { if (refFormat._shading != null) { format._shading = refFormat._shading.Clone(); format._shading._parent = format; } //format.shading = refFormat.shading; } else if (refFormat._shading != null) { FlattenShading(format._shading, refFormat._shading); } if (format._borders == null) { format._borders = refFormat._borders; } else if (refFormat._borders != null) { FlattenBorders(format._borders, refFormat._borders); } //if (format.tabStops == null) // format.tabStops = refFormat.tabStops; if (refFormat._tabStops != null) { FlattenTabStops(format.TabStops, refFormat._tabStops); } if (refFormat._listInfo != null) { FlattenListInfo(format.ListInfo, refFormat._listInfo); } }
private void MainForm_Load(object sender, EventArgs e) { //桌面目录 string desktopDir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); //文件 string Path_out = Path.Combine(desktopDir, "test_" + DateTime.Now.Ticks + ".docx"); string tempFile = Path.Combine(desktopDir, "newtemplete.docx"); //获取模板路径,这个根据个人模板路径而定。 WordDocument doc = new WordDocument(tempFile); //查找需要生成的节点的样式 Aspose.Words.Lists.List numberList = null; ParagraphFormat paragraphFormat = null; NodeCollection nodes = doc.WordDoc.GetChildNodes(NodeType.Paragraph, true); foreach (Node node in nodes) { if (node.Range.Text.Contains("项目分解节点模板")) { if (numberList == null) { numberList = ((Paragraph)node).ListFormat.List; paragraphFormat = ((Paragraph)node).ParagraphFormat; } node.Remove(); } } //替换封皮信息 Dictionary <string, object> dic = new Dictionary <string, object>(); //创建键值对 第一个string 为书签名称 第二个string为要填充的数据 dic.Add("首页密级", "保密"); dic.Add("申报领域", "芯片技术"); dic.Add("申报方向", "量子芯片技术"); dic.Add("项目名称", "量子芯片制造"); dic.Add("单位名称", "芯片技术研究院"); dic.Add("单位常用名", "芯片技术研究院天津分院"); dic.Add("项目负责人", "张三"); dic.Add("单位联系人", "张五"); dic.Add("联系电话", "68111111"); dic.Add("通信地址", "天津滨海区"); dic.Add("研究周期", "5"); dic.Add("研究经费", "1000"); dic.Add("项目关键字", "aaa;bbb;ccc;ddd"); doc.insertAllWithBookmark(dic); dic = new Dictionary <string, object>(); dic.Add("%<test>%", "测试替换... "); doc.replaceAllWithBookmark(dic); //插入文档 doc.insertDocumentAfterBookMark(new Document(Path.Combine(desktopDir, "ttt.docx")), "项目摘要", true); doc.insertDocumentAfterBookMark(new Document(Path.Combine(desktopDir, "ttt.docx")), "基本概念及内涵", true); doc.insertDocumentAfterBookMark(new Document(Path.Combine(desktopDir, "ttt.docx")), "军事需求分析", true); doc.insertDocumentAfterBookMark(new Document(Path.Combine(desktopDir, "ttt.docx")), "研究现状", true); doc.insertDocumentAfterBookMark(new Document(Path.Combine(desktopDir, "ttt.docx")), "研究目标", true); doc.insertDocumentAfterBookMark(new Document(Path.Combine(desktopDir, "ttt.docx")), "基础性问题", true); doc.insertDocumentAfterBookMark(new Document(Path.Combine(desktopDir, "rrr.docx")), "课题之间的关系", true); doc.insertDocumentAfterBookMark(new Document(Path.Combine(desktopDir, "ttt.docx")), "研究成果及考核指标", true); doc.insertDocumentAfterBookMark(new Document(Path.Combine(desktopDir, "ttt.docx")), "评估方案", true); doc.insertDocumentAfterBookMark(new Document(Path.Combine(desktopDir, "ttt.docx")), "预期效益", true); doc.insertDocumentAfterBookMark(new Document(Path.Combine(desktopDir, "ttt.docx")), "项目负责人C", true); doc.insertDocumentAfterBookMark(new Document(Path.Combine(desktopDir, "ttt.docx")), "研究团队", true); doc.insertDocumentAfterBookMark(new Document(Path.Combine(desktopDir, "ttt.docx")), "研究基础与保障条件", true); doc.insertDocumentAfterBookMark(new Document(Path.Combine(desktopDir, "ttt.docx")), "组织实施与风险控制", true); doc.insertDocumentAfterBookMark(new Document(Path.Combine(desktopDir, "ttt.docx")), "与有关计划关系", true); //输出项目分解的节点 doc.WordDocBuilder.MoveToBookmark("项目分解详细"); doc.WordDocBuilder.ListFormat.List = numberList; double oldFirstLineIndent = doc.WordDocBuilder.ParagraphFormat.FirstLineIndent; doc.WordDocBuilder.ParagraphFormat.FirstLineIndent = paragraphFormat.FirstLineIndent; doc.WordDocBuilder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading2; doc.WordDocBuilder.Writeln("光刻机"); doc.WordDocBuilder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading3; doc.WordDocBuilder.Writeln("、研究目标"); doc.WordDocBuilder.StartBookmark("autoBookmark_1"); doc.WordDocBuilder.EndBookmark("autoBookmark_1"); doc.WordDocBuilder.Writeln("、研究内容"); doc.WordDocBuilder.StartBookmark("autoBookmark_2"); doc.WordDocBuilder.EndBookmark("autoBookmark_2"); doc.WordDocBuilder.Writeln("、研究思路"); doc.WordDocBuilder.StartBookmark("autoBookmark_3"); doc.WordDocBuilder.EndBookmark("autoBookmark_3"); doc.WordDocBuilder.Writeln("、负责单位及负责人"); doc.WordDocBuilder.StartBookmark("autoBookmark_4"); doc.WordDocBuilder.EndBookmark("autoBookmark_4"); doc.WordDocBuilder.Writeln("、研究经费"); doc.WordDocBuilder.StartBookmark("autoBookmark_5"); doc.WordDocBuilder.EndBookmark("autoBookmark_5"); doc.WordDocBuilder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading2; doc.WordDocBuilder.Writeln("材料"); doc.WordDocBuilder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading3; doc.WordDocBuilder.Writeln("、研究目标"); doc.WordDocBuilder.StartBookmark("autoBookmark_6"); doc.WordDocBuilder.EndBookmark("autoBookmark_6"); doc.WordDocBuilder.Writeln("、研究内容"); doc.WordDocBuilder.StartBookmark("autoBookmark_7"); doc.WordDocBuilder.EndBookmark("autoBookmark_7"); doc.WordDocBuilder.Writeln("、研究思路"); doc.WordDocBuilder.StartBookmark("autoBookmark_8"); doc.WordDocBuilder.EndBookmark("autoBookmark_8"); doc.WordDocBuilder.Writeln("、负责单位及负责人"); doc.WordDocBuilder.StartBookmark("autoBookmark_9"); doc.WordDocBuilder.EndBookmark("autoBookmark_9"); doc.WordDocBuilder.Writeln("、研究经费"); doc.WordDocBuilder.StartBookmark("autoBookmark_10"); doc.WordDocBuilder.EndBookmark("autoBookmark_10"); doc.WordDocBuilder.ListFormat.RemoveNumbers(); doc.WordDocBuilder.ParagraphFormat.FirstLineIndent = oldFirstLineIndent; //doc.WordDocBuilder.InsertHtml("<h1>1、分析数据</h1>"); //doc.WordDocBuilder.InsertHtml("<h2>1.1 数据一</h2>"); //doc.WordDocBuilder.InsertHtml("<h2>1.2 数据二</h2>"); //doc.WordDocBuilder.InsertHtml("<h3>1.2.1 计算分析</h3>"); //doc.WordDocBuilder.InsertHtml("<h1>2、分析数据</h1>"); //doc.WordDocBuilder.InsertHtml("<h2>2.1 数据一</h2>"); //填充课题详细内容 for (int k = 1; k <= 10; k++) { doc.insertDocumentAfterBookMark(new Document(Path.Combine(desktopDir, "rrr.docx")), "autoBookmark_" + k, k == 10 ? true : false); } ////插入一个新页(横向) //doc.WordDocBuilder.MoveToBookmark("附件3"); //doc.WordDocBuilder.InsertBreak(BreakType.SectionBreakNewPage); //doc.WordDocBuilder.PageSetup.Orientation = Aspose.Words.Orientation.Landscape; //编辑表格数据 NodeCollection nodesss = doc.WordDoc.GetChildNodes(NodeType.Table, true); foreach (Node nn in nodesss) { if (nn is Table) { Table t = (Table)nn; if (t.Range.Text.Contains("进度要求")) { DataTable dtt = new DataTable(); dtt.Columns.Add("A", typeof(string)); dtt.Columns.Add("B", typeof(string)); dtt.Columns.Add("C", typeof(string)); dtt.Rows.Add(new object[] { "111", "222", "333" }); dtt.Rows.Add(new object[] { "111", "222", "333" }); dtt.Rows.Add(new object[] { "111", "222", "333" }); dtt.Rows.Add(new object[] { "111", "222", "333" }); dtt.Rows.Add(new object[] { "111", "222", "333" }); dtt.Rows.Add(new object[] { "111", "222", "333" }); dtt.Rows.Add(new object[] { "111", "222", "333" }); dtt.Rows.Add(new object[] { "111", "222", "333" }); doc.fillDataToTable(t, dtt); t.Rows.RemoveAt(1); } } } //写保密资质 doc.WordDocBuilder.MoveToBookmark("附件2"); doc.WordDocBuilder.InsertImage(Image.FromFile("c:\\t.png")); //统一编号 doc.WordDoc.FirstSection.PageSetup.SectionStart = SectionStart.EvenPage; doc.WordDoc.FirstSection.PageSetup.RestartPageNumbering = true; //更新域 doc.WordDoc.UpdateFields(); doc.WordDoc.UpdateListLabels(); doc.WordDoc.UpdatePageLayout(); doc.WordDoc.UpdateTableLayout(); doc.WordDoc.UpdateThumbnail(); //保存word doc.WordDoc.Save(Path_out); //保存word //打开 System.Diagnostics.Process.Start(Path_out); }
private void method_2(Paragraph A_0, ParagraphFormat A_1) { int num = 0; if (A_0 != null) { int key = -1; object obj2 = null; if (A_1.method_6(0x460)) { key = (int)A_1.method_31(0x460); } else if ((A_1.FormatRevision != null) && A_1.FormatRevision.method_4().method_6(0x460)) { key = (int)A_1.FormatRevision.method_4().method_31(0x460); } if (A_1.method_6(0x456)) { obj2 = A_1.method_31(0x456); } else if ((A_1.FormatRevision != null) && A_1.FormatRevision.method_4().method_6(0x456)) { obj2 = A_1.FormatRevision.method_4().method_31(0x456); } if (key == 0) { A_0.ListFormat.IsEmptyList = true; } else if ((key > 0) && this.document_0.ListStyles.ListStyleNames.ContainsKey(key.ToString())) { string name = this.document_0.ListStyles.ListStyleNames[key.ToString()]; ListStyle style = this.document_0.ListStyles.FindByName(name); if (style != null) { if (!string.IsNullOrEmpty(style.BaseListStyleName) && this.document_0.ListStyles.ListStyleNames.ContainsKey(style.BaseListStyleName)) { string str = this.document_0.ListStyles.ListStyleNames[style.BaseListStyleName]; if (this.document_0.ListStyles.ListStyleNames.ContainsKey(str)) { name = this.document_0.ListStyles.ListStyleNames[str]; } } if (name != null) { A_0.ListFormat.ApplyStyle(name); } if (this.class764_0.method_48().ContainsKey(key)) { A_0.ListFormat.LFOStyleName = this.class764_0.method_48()[key]; } } if (obj2 != null) { int num3; if (obj2.GetType().Name == BookmarkStart.b("搥儧帩䤫", num)) { num3 = (byte)obj2; } else { num3 = (int)obj2; } if (num3 > 8) { num3 = 8; } A_0.ListFormat.ListLevelNumber = num3; } } } }
public void method_10(ParagraphFormat A_0) { this.paragraphFormat_0 = A_0; }
public void ParagraphSpacingAndIndents() { //ExStart //ExFor:ParagraphFormat.CharacterUnitLeftIndent //ExFor:ParagraphFormat.CharacterUnitRightIndent //ExFor:ParagraphFormat.CharacterUnitFirstLineIndent //ExFor:ParagraphFormat.LineUnitBefore //ExFor:ParagraphFormat.LineUnitAfter //ExSummary:Shows how to change paragraph spacing and indents. Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); ParagraphFormat format = doc.FirstSection.Body.FirstParagraph.ParagraphFormat; // Below are five different spacing options, along with the properties that their configuration indirectly affects. // 1 - Left indent: Assert.AreEqual(format.LeftIndent, 0.0d); format.CharacterUnitLeftIndent = 10.0; Assert.AreEqual(format.LeftIndent, 120.0d); // 2 - Right indent: Assert.AreEqual(format.RightIndent, 0.0d); format.CharacterUnitRightIndent = -5.5; Assert.AreEqual(format.RightIndent, -66.0d); // 3 - Hanging indent: Assert.AreEqual(format.FirstLineIndent, 0.0d); format.CharacterUnitFirstLineIndent = 20.3; Assert.AreEqual(format.FirstLineIndent, 243.59d, 0.1d); // 4 - Line spacing before paragraphs: Assert.AreEqual(format.SpaceBefore, 0.0d); format.LineUnitBefore = 5.1; Assert.AreEqual(format.SpaceBefore, 61.1d, 0.1d); // 5 - Line spacing after paragraphs: Assert.AreEqual(format.SpaceAfter, 0.0d); format.LineUnitAfter = 10.9; Assert.AreEqual(format.SpaceAfter, 130.8d, 0.1d); builder.Writeln("Lorem ipsum dolor sit amet, consectetur adipiscing elit, " + "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."); builder.Write("测试文档测试文档测试文档测试文档测试文档测试文档测试文档测试文档测试" + "文档测试文档测试文档测试文档测试文档测试文档测试文档测试文档测试文档测试文档"); //ExEnd doc = DocumentHelper.SaveOpen(doc); format = doc.FirstSection.Body.FirstParagraph.ParagraphFormat; Assert.AreEqual(format.CharacterUnitLeftIndent, 10.0d); Assert.AreEqual(format.LeftIndent, 120.0d); Assert.AreEqual(format.CharacterUnitRightIndent, -5.5d); Assert.AreEqual(format.RightIndent, -66.0d); Assert.AreEqual(format.CharacterUnitFirstLineIndent, 20.3d); Assert.AreEqual(format.FirstLineIndent, 243.59d, 0.1d); Assert.AreEqual(format.LineUnitBefore, 5.1d, 0.1d); Assert.AreEqual(format.SpaceBefore, 61.1d, 0.1d); Assert.AreEqual(format.LineUnitAfter, 10.9d); Assert.AreEqual(format.SpaceAfter, 130.8d, 0.1d); }
private Class646(ParagraphFormat A_0) { this.paragraphFormat_0 = A_0; }
internal void method_27(Paragraph A_0, float A_1, Class206 A_2) { Tab tab; int num = 12; float num2 = 20f; A_2.method_15().Clear(); A_2.list_1.Clear(); ParagraphFormat paragraphFormat = A_0.Format; if (!A_0.Document.Settings.method_5().method_0(CompatibilityOptions.NoTabForInd) && (paragraphFormat.FirstLineIndent < 0f)) { A_2.method_24(A_1 + paragraphFormat.LeftIndent, TabJustification.Left, TabLeader.NoLeader); } IParagraphStyle style = A_0.GetStyle(); if (style == null) { style = A_0.Document.Styles.FindByName(BookmarkStart.b("簱嬳䐵唷嬹倻", num), StyleType.ParagraphStyle) as IParagraphStyle; if (style == null) { style = (ParagraphStyle)Style.CreateBuiltinStyle(BuiltinStyle.Normal, A_0.Document); } } if (style.ParagraphFormat.Tabs.Count > 0) { paragraphFormat = A_0.GetStyle().ParagraphFormat; } int num3 = 0; int count = paragraphFormat.Tabs.Count; while (num3 < count) { tab = paragraphFormat.Tabs[num3]; if ((tab.Position != 0f) || (tab.DeletePosition == 0f)) { A_2.method_24(((tab.Position != 0f) ? tab.Position : (tab.DeletePosition / num2)) + A_1, (TabJustification)tab.Justification, (TabLeader)tab.TabLeader); } A_2.method_15().Add(tab); num3++; } paragraphFormat = A_0.Format; int num5 = 0; int num6 = paragraphFormat.Tabs.Count; while (num5 < num6) { int num10; tab = paragraphFormat.Tabs[num5]; bool flag = false; bool flag2 = false; int index = 0; double d = (tab.DeletePosition / num2) + A_1; double num9 = tab.Position + A_1; if (A_2.list_1.Count != 0) { num10 = 0; while (num10 < A_2.list_1.Count) { if (Math.Truncate((double)A_2.list_1[num10].method_4()) == Math.Truncate(num9)) { goto Label_0227; } if (((Math.Truncate((double)A_2.list_1[num10].method_4()) == Math.Truncate(d)) && (tab.DeletePosition != 0f)) && (tab.Position == 0f)) { goto Label_0230; } num10++; } } goto Label_0237; Label_0227: flag = true; index = num10; goto Label_0237; Label_0230: flag2 = true; index = num10; Label_0237: if (((tab.Position != 0f) || (tab.DeletePosition == 0f)) && (!flag2 && !flag)) { A_2.method_24(((tab.Position != 0f) ? tab.Position : (tab.DeletePosition / num2)) + A_1, (TabJustification)tab.Justification, (TabLeader)tab.TabLeader); A_2.method_15().Add(tab); } else if (flag2) { A_2.list_1.RemoveAt(index); } else if (flag) { A_2.list_1[index].method_1((TabJustification)tab.Justification); A_2.list_1[index].method_5(((tab.Position != 0f) ? tab.Position : (tab.DeletePosition / num2)) + A_1); A_2.list_1[index].method_3((TabLeader)tab.TabLeader); } num5++; } }
///<summary>Supply pd so that we know the paper size and margins.</summary> public static void CreateDocument(FormRpStatement sender, MigraDoc.DocumentObjectModel.Document doc, PrintDocument pd, Family fam, Patient pat, DataSet dataSet, Statement Stmt) { //doc= new MigraDoc.DocumentObjectModel.Document();//don't do this or the reference to the original doc will be lost. doc.DefaultPageSetup.PageWidth = Unit.FromInch((double)pd.DefaultPageSettings.PaperSize.Width / 100); doc.DefaultPageSetup.PageHeight = Unit.FromInch((double)pd.DefaultPageSettings.PaperSize.Height / 100); doc.DefaultPageSetup.TopMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Top / 100); doc.DefaultPageSetup.LeftMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Left / 100); doc.DefaultPageSetup.RightMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Right / 100); doc.DefaultPageSetup.BottomMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Bottom / 100); MigraDoc.DocumentObjectModel.Section section = doc.AddSection(); //so that Swiss will have different footer for each patient. string text; MigraDoc.DocumentObjectModel.Font font; //GetPatGuar(PatNums[famIndex][0]); //Family fam=Patients.GetFamily(Stmt.PatNum); Patient PatGuar = fam.ListPats[0]; //.Copy(); //Patient pat=fam.GetPatient(Stmt.PatNum); DataTable tableMisc = dataSet.Tables["misc"]; //HEADING------------------------------------------------------------------------------ #region Heading Paragraph par = section.AddParagraph(); ParagraphFormat parformat = new ParagraphFormat(); parformat.Alignment = ParagraphAlignment.Center; par.Format = parformat; font = MigraDocHelper.CreateFont(14, true); text = "This statement was generated from the plug-in"; par.AddFormattedText(text, font); text = DateTime.Today.ToShortDateString(); font = MigraDocHelper.CreateFont(10); par.AddLineBreak(); par.AddFormattedText(text, font); text = Lan.g("FormRpStatement", "Account Number") + " "; if (PrefC.GetBool(PrefName.StatementAccountsUseChartNumber)) { text += PatGuar.ChartNumber; } else { text += PatGuar.PatNum; } par.AddLineBreak(); par.AddFormattedText(text, font); TextFrame frame; #endregion //Practice Address---------------------------------------------------------------------- #region Practice Address if (PrefC.GetBool(PrefName.StatementShowReturnAddress)) { font = MigraDocHelper.CreateFont(10); frame = section.AddTextFrame(); frame.RelativeVertical = RelativeVertical.Page; frame.RelativeHorizontal = RelativeHorizontal.Page; frame.MarginLeft = Unit.Zero; frame.MarginTop = Unit.Zero; frame.Top = TopPosition.Parse("0.5 in"); frame.Left = LeftPosition.Parse("0.3 in"); frame.Width = Unit.FromInch(3); if (!PrefC.GetBool(PrefName.EasyNoClinics) && Clinics.GetCount() > 0 && //if using clinics Clinics.GetClinic(PatGuar.ClinicNum) != null) //and this patient assigned to a clinic { Clinic clinic = Clinics.GetClinic(PatGuar.ClinicNum); par = frame.AddParagraph(); par.Format.Font = font; par.AddText(clinic.Description); par.AddLineBreak(); par.AddText(clinic.Address); par.AddLineBreak(); if (clinic.Address2 != "") { par.AddText(clinic.Address2); par.AddLineBreak(); } if (CultureInfo.CurrentCulture.Name.EndsWith("CH")) //CH is for switzerland. eg de-CH { par.AddText(clinic.Zip + " " + clinic.City); } else { par.AddText(clinic.City + ", " + clinic.State + " " + clinic.Zip); } par.AddLineBreak(); text = clinic.Phone; if (text.Length == 10) { text = "(" + text.Substring(0, 3) + ")" + text.Substring(3, 3) + "-" + text.Substring(6); } par.AddText(text); par.AddLineBreak(); } else { par = frame.AddParagraph(); par.Format.Font = font; par.AddText(PrefC.GetString(PrefName.PracticeTitle)); par.AddLineBreak(); if (CultureInfo.CurrentCulture.Name == "en-AU") //English (Australia) { Provider defaultProv = Providers.GetProv(PrefC.GetLong(PrefName.PracticeDefaultProv)); par.AddText("ABN: " + defaultProv.NationalProvID); par.AddLineBreak(); } par.AddText(PrefC.GetString(PrefName.PracticeAddress)); par.AddLineBreak(); if (PrefC.GetString(PrefName.PracticeAddress2) != "") { par.AddText(PrefC.GetString(PrefName.PracticeAddress2)); par.AddLineBreak(); } if (CultureInfo.CurrentCulture.Name.EndsWith("CH")) //CH is for switzerland. eg de-CH { par.AddText(PrefC.GetString(PrefName.PracticeZip) + " " + PrefC.GetString(PrefName.PracticeCity)); } else { par.AddText(PrefC.GetString(PrefName.PracticeCity) + ", " + PrefC.GetString(PrefName.PracticeST) + " " + PrefC.GetString(PrefName.PracticeZip)); } par.AddLineBreak(); text = PrefC.GetString(PrefName.PracticePhone); if (text.Length == 10) { text = "(" + text.Substring(0, 3) + ")" + text.Substring(3, 3) + "-" + text.Substring(6); } par.AddText(text); par.AddLineBreak(); } } #endregion //AMOUNT ENCLOSED------------------------------------------------------------------------------------------------------ #region Amount Enclosed Table table; Column col; Row row; Cell cell; frame = MigraDocHelper.CreateContainer(section, 450, 110, 330, 29); if (!Stmt.HidePayment) { table = MigraDocHelper.DrawTable(frame, 0, 0, 29); col = table.AddColumn(Unit.FromInch(1.1)); col = table.AddColumn(Unit.FromInch(1.1)); col = table.AddColumn(Unit.FromInch(1.1)); row = table.AddRow(); row.Format.Alignment = ParagraphAlignment.Center; row.Borders.Color = Colors.Black; row.Shading.Color = Colors.LightGray; row.TopPadding = Unit.FromInch(0); row.BottomPadding = Unit.FromInch(0); font = MigraDocHelper.CreateFont(8, true); cell = row.Cells[0]; par = cell.AddParagraph(); par.AddFormattedText(Lan.g("FormRpStatement", "Amount Due"), font); cell = row.Cells[1]; par = cell.AddParagraph(); par.AddFormattedText(Lan.g("FormRpStatement", "Date Due"), font); cell = row.Cells[2]; par = cell.AddParagraph(); par.AddFormattedText(Lan.g("FormRpStatement", "Amount Enclosed"), font); row = table.AddRow(); row.Format.Alignment = ParagraphAlignment.Center; row.Borders.Left.Color = Colors.Gray; row.Borders.Bottom.Color = Colors.Gray; row.Borders.Right.Color = Colors.Gray; font = MigraDocHelper.CreateFont(9); double balTotal = PatGuar.BalTotal; if (!PrefC.GetBool(PrefName.BalancesDontSubtractIns)) //this is typical { balTotal -= PatGuar.InsEst; } for (int m = 0; m < tableMisc.Rows.Count; m++) { if (tableMisc.Rows[m]["descript"].ToString() == "payPlanDue") { balTotal += PIn.Double(tableMisc.Rows[m]["value"].ToString()); //payPlanDue;//PatGuar.PayPlanDue; } } text = balTotal.ToString("F"); cell = row.Cells[0]; par = cell.AddParagraph(); par.AddFormattedText(text, font); if (PrefC.GetLong(PrefName.StatementsCalcDueDate) == -1) { text = Lan.g("FormRpStatement", "Upon Receipt"); } else { text = DateTime.Today.AddDays(PrefC.GetLong(PrefName.StatementsCalcDueDate)).ToShortDateString(); } cell = row.Cells[1]; par = cell.AddParagraph(); par.AddFormattedText(text, font); } #endregion //Credit Card Info-------------------------------------------------------------------------------------------------------- #region Credit Card Info if (!Stmt.HidePayment) { if (PrefC.GetBool(PrefName.StatementShowCreditCard)) { float yPos = 60; font = MigraDocHelper.CreateFont(7, true); text = Lan.g("FormRpStatement", "CREDIT CARD TYPE"); MigraDocHelper.DrawString(frame, text, font, 0, yPos); float rowHeight = 26; System.Drawing.Font wfont = new System.Drawing.Font("Arial", 7, FontStyle.Bold); System.Drawing.Image img = new Bitmap(500, 30); Graphics g = Graphics.FromImage(img); //just to measure strings MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width, yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g)); yPos += rowHeight; text = Lan.g("FormRpStatement", "#"); MigraDocHelper.DrawString(frame, text, font, 0, yPos); MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width, yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g)); yPos += rowHeight; text = Lan.g("FormRpStatement", "3 DIGIT CSV"); MigraDocHelper.DrawString(frame, text, font, 0, yPos); MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width, yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g)); yPos += rowHeight; text = Lan.g("FormRpStatement", "EXPIRES"); MigraDocHelper.DrawString(frame, text, font, 0, yPos); MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width, yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g)); yPos += rowHeight; text = Lan.g("FormRpStatement", "AMOUNT APPROVED"); MigraDocHelper.DrawString(frame, text, font, 0, yPos); MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width, yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g)); yPos += rowHeight; text = Lan.g("FormRpStatement", "NAME"); MigraDocHelper.DrawString(frame, text, font, 0, yPos); MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width, yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g)); yPos += rowHeight; text = Lan.g("FormRpStatement", "SIGNATURE"); MigraDocHelper.DrawString(frame, text, font, 0, yPos); MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width, yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g)); yPos -= rowHeight; text = Lan.g("FormRpStatement", "(As it appears on card)"); wfont = new System.Drawing.Font("Arial", 5); font = MigraDocHelper.CreateFont(5); MigraDocHelper.DrawString(frame, text, font, 625 - g.MeasureString(text, wfont).Width / 2 + 5, yPos + 13); g.Dispose(); img = null; } } #endregion //Patient's Billing Address--------------------------------------------------------------------------------------------- #region Patient Billing Address font = MigraDocHelper.CreateFont(11); frame = MigraDocHelper.CreateContainer(section, 62.5f + 12.5f, 225 + 1, 300, 200); par = frame.AddParagraph(); par.Format.Font = font; if (Stmt.SinglePatient) { par.AddText(fam.GetNameInFamFL(Stmt.PatNum)); } else { par.AddText(PatGuar.GetNameFLFormal()); } par.AddLineBreak(); par.AddText(PatGuar.Address); par.AddLineBreak(); if (PatGuar.Address2 != "") { par.AddText(PatGuar.Address2); par.AddLineBreak(); } if (CultureInfo.CurrentCulture.Name.EndsWith("CH")) //CH is for switzerland. eg de-CH { par.AddText(PatGuar.Zip + " " + PatGuar.City); } else { par.AddText(PatGuar.City + ", " + PatGuar.State + " " + PatGuar.Zip); } //perforated line------------------------------------------------------------------------------------------------------ //yPos=350;//3.62 inches from top, 1/3 page down frame = MigraDocHelper.CreateContainer(section, 0, 350, 850, 30); if (!Stmt.HidePayment) { MigraDocHelper.DrawLine(frame, System.Drawing.Color.LightGray, 0, 0, 850, 0); text = Lan.g("FormRpStatement", "PLEASE DETACH AND RETURN THE UPPER PORTION WITH YOUR PAYMENT"); font = MigraDocHelper.CreateFont(6, true, System.Drawing.Color.Gray); par = frame.AddParagraph(); par.Format.Alignment = ParagraphAlignment.Center; par.Format.Font = font; par.AddText(text); } #endregion //Australian Provider Legend #region Australian Provider Legend int legendOffset = 0; if (CultureInfo.CurrentCulture.Name == "en-AU") //English (Australia) { Providers.RefreshCache(); List <Provider> listProviders = Providers.GetDeepCopy(true); legendOffset = 25 + 15 * (1 + listProviders.Count); MigraDocHelper.InsertSpacer(section, legendOffset); frame = MigraDocHelper.CreateContainer(section, 45, 390, 250, legendOffset); par = frame.AddParagraph(); par.Format.Font = MigraDocHelper.CreateFont(8, true); par.AddLineBreak(); par.AddText("PROVIDERS:"); par = frame.AddParagraph(); par.Format.Font = MigraDocHelper.CreateFont(8, false); foreach (Provider prov in listProviders) { string suffix = ""; if (prov.Suffix.Trim() != "") { suffix = ", " + prov.Suffix.Trim(); } par.AddText(prov.Abbr + " - " + prov.FName + " " + prov.LName + suffix + " - " + prov.MedicaidID); par.AddLineBreak(); } par.AddLineBreak(); } #endregion //Aging----------------------------------------------------------------------------------- #region Aging MigraDocHelper.InsertSpacer(section, 275); frame = MigraDocHelper.CreateContainer(section, 55, 390 + legendOffset, 250, 29); if (!Stmt.HidePayment) { table = MigraDocHelper.DrawTable(frame, 0, 0, 29); col = table.AddColumn(Unit.FromInch(1.1)); col = table.AddColumn(Unit.FromInch(1.1)); col = table.AddColumn(Unit.FromInch(1.1)); col = table.AddColumn(Unit.FromInch(1.1)); row = table.AddRow(); row.Format.Alignment = ParagraphAlignment.Center; row.Borders.Color = Colors.Black; row.Shading.Color = Colors.LightGray; row.TopPadding = Unit.FromInch(0); row.BottomPadding = Unit.FromInch(0); font = MigraDocHelper.CreateFont(8, true); cell = row.Cells[0]; par = cell.AddParagraph(); par.AddFormattedText(Lan.g("FormRpStatement", "0-30"), font); cell = row.Cells[1]; par = cell.AddParagraph(); par.AddFormattedText(Lan.g("FormRpStatement", "31-60"), font); cell = row.Cells[2]; par = cell.AddParagraph(); par.AddFormattedText(Lan.g("FormRpStatement", "61-90"), font); cell = row.Cells[3]; par = cell.AddParagraph(); par.AddFormattedText(Lan.g("FormRpStatement", "over 90"), font); row = table.AddRow(); row.Format.Alignment = ParagraphAlignment.Center; row.Borders.Left.Color = Colors.Gray; row.Borders.Bottom.Color = Colors.Gray; row.Borders.Right.Color = Colors.Gray; font = MigraDocHelper.CreateFont(9); text = PatGuar.Bal_0_30.ToString("F"); cell = row.Cells[0]; par = cell.AddParagraph(); par.AddFormattedText(text, font); text = PatGuar.Bal_31_60.ToString("F"); cell = row.Cells[1]; par = cell.AddParagraph(); par.AddFormattedText(text, font); text = PatGuar.Bal_61_90.ToString("F"); cell = row.Cells[2]; par = cell.AddParagraph(); par.AddFormattedText(text, font); text = PatGuar.BalOver90.ToString("F"); cell = row.Cells[3]; par = cell.AddParagraph(); par.AddFormattedText(text, font); } #endregion //Floating Balance, Ins info------------------------------------------------------------------- #region FloatingBalance frame = MigraDocHelper.CreateContainer(section, 460, 380 + legendOffset, 250, 200); //table=MigraDocHelper.DrawTable(frame,0,0,90); par = frame.AddParagraph(); parformat = new ParagraphFormat(); parformat.Alignment = ParagraphAlignment.Right; par.Format = parformat; font = MigraDocHelper.CreateFont(10, false); MigraDoc.DocumentObjectModel.Font fontBold = MigraDocHelper.CreateFont(10, true); if (PrefC.GetBool(PrefName.BalancesDontSubtractIns)) { text = Lan.g("FormRpStatement", "Balance:"); par.AddFormattedText(text, fontBold); //par.AddLineBreak(); //text = Lan.g(this, "Ins Pending:"); //par.AddFormattedText(text, font); //par.AddLineBreak(); //text = Lan.g(this, "After Ins:"); //par.AddFormattedText(text, font); //par.AddLineBreak(); } else //this is more common { if (PrefC.GetBool(PrefName.FuchsOptionsOn)) { text = Lan.g("FormRpStatement", "Balance:"); par.AddFormattedText(text, font); par.AddLineBreak(); text = Lan.g("FormRpStatement", "-Ins Estimate:"); par.AddFormattedText(text, font); par.AddLineBreak(); text = Lan.g("FormRpStatement", "=Owed Now:"); par.AddFormattedText(text, fontBold); par.AddLineBreak(); } else { text = Lan.g("FormRpStatement", "Total:"); par.AddFormattedText(text, font); par.AddLineBreak(); text = Lan.g("FormRpStatement", "-Ins Estimate:"); par.AddFormattedText(text, font); par.AddLineBreak(); text = Lan.g("FormRpStatement", "=Balance:"); par.AddFormattedText(text, fontBold); par.AddLineBreak(); } } frame = MigraDocHelper.CreateContainer(section, 730, 380 + legendOffset, 100, 200); //table=MigraDocHelper.DrawTable(frame,0,0,90); par = frame.AddParagraph(); parformat = new ParagraphFormat(); parformat.Alignment = ParagraphAlignment.Left; par.Format = parformat; font = MigraDocHelper.CreateFont(10, false); //numbers: if (PrefC.GetBool(PrefName.BalancesDontSubtractIns)) { text = PatGuar.BalTotal.ToString("c"); par.AddFormattedText(text, fontBold); //par.AddLineBreak(); //text = PatGuar.InsEst.ToString("c"); //par.AddFormattedText(text, font); //par.AddLineBreak(); //text = (PatGuar.BalTotal - PatGuar.InsEst).ToString("c"); //par.AddFormattedText(text, font); //par.AddLineBreak(); } else //more common { if (Stmt.SinglePatient) { double patInsEst = 0; for (int m = 0; m < tableMisc.Rows.Count; m++) { if (tableMisc.Rows[m]["descript"].ToString() == "patInsEst") { patInsEst = PIn.Double(tableMisc.Rows[m]["value"].ToString()); } } double patBal = pat.EstBalance - patInsEst; text = pat.EstBalance.ToString("c"); par.AddFormattedText(text, font); par.AddLineBreak(); text = patInsEst.ToString("c"); par.AddFormattedText(text, font); par.AddLineBreak(); text = patBal.ToString("c"); par.AddFormattedText(text, fontBold); } else { text = PatGuar.BalTotal.ToString("c"); par.AddFormattedText(text, font); par.AddLineBreak(); text = PatGuar.InsEst.ToString("c"); par.AddFormattedText(text, font); par.AddLineBreak(); text = (PatGuar.BalTotal - PatGuar.InsEst).ToString("c"); par.AddFormattedText(text, fontBold); par.AddLineBreak(); } } MigraDocHelper.InsertSpacer(section, 80); #endregion FloatingBalance //Bold note------------------------------------------------------------------------------- #region Bold note if (Stmt.NoteBold != "") { MigraDocHelper.InsertSpacer(section, 7); font = MigraDocHelper.CreateFont(10, true, System.Drawing.Color.DarkRed); par = section.AddParagraph(); par.Format.Font = font; par.AddText(Stmt.NoteBold); MigraDocHelper.InsertSpacer(section, 8); } #endregion Bold note //Payment plan grid definition--------------------------------------------------------------------------------- #region PayPlan grid definition ODGridColumn gcol; ODGridRow grow; ODGrid gridPP = new ODGrid(); //this.Controls.Add(gridPP); gridPP.BeginUpdate(); gridPP.Columns.Clear(); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Date"), 73); gridPP.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Description"), 270); gridPP.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Charges"), 60, HorizontalAlignment.Right); gridPP.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Credits"), 60, HorizontalAlignment.Right); gridPP.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Balance"), 60, HorizontalAlignment.Right); gridPP.Columns.Add(gcol); gridPP.Width = gridPP.WidthAllColumns + 20; gridPP.EndUpdate(); #endregion PayPlan grid definition //Payment plan grid. There will be only one, if any----------------------------------------------------------------- #region PayPlan grid DataTable tablePP = dataSet.Tables["payplan"]; ODGridCell gcell; if (tablePP.Rows.Count > 0) { //MigraDocHelper.InsertSpacer(section,5); par = section.AddParagraph(); par.Format.Font = MigraDocHelper.CreateFont(10, true); par.Format.Alignment = ParagraphAlignment.Center; //par.Format.SpaceBefore=Unit.FromInch(.05); //par.Format.SpaceAfter=Unit.FromInch(.05); par.AddText(Lan.g("FormRpStatement", "Payment Plans")); MigraDocHelper.InsertSpacer(section, 2); gridPP.BeginUpdate(); gridPP.Rows.Clear(); for (int p = 0; p < tablePP.Rows.Count; p++) { grow = new ODGridRow(); grow.Cells.Add(tablePP.Rows[p]["date"].ToString()); grow.Cells.Add(tablePP.Rows[p]["description"].ToString()); grow.Cells.Add(tablePP.Rows[p]["charges"].ToString()); grow.Cells.Add(tablePP.Rows[p]["credits"].ToString()); gcell = new ODGridCell(tablePP.Rows[p]["balance"].ToString()); if (p == tablePP.Rows.Count - 1) { gcell.Bold = YN.Yes; } else if (tablePP.Rows[p + 1]["balance"].ToString() == "") //if next row balance is blank. { gcell.Bold = YN.Yes; } grow.Cells.Add(gcell); gridPP.Rows.Add(grow); } gridPP.EndUpdate(); MigraDocHelper.DrawGrid(section, gridPP); MigraDocHelper.InsertSpacer(section, 2); par = section.AddParagraph(); par.Format.Font = MigraDocHelper.CreateFont(10, true); par.Format.Alignment = ParagraphAlignment.Right; par.Format.RightIndent = Unit.FromInch(0.25); double payPlanDue = 0; for (int m = 0; m < tableMisc.Rows.Count; m++) { if (tableMisc.Rows[m]["descript"].ToString() == "payPlanDue") { payPlanDue = PIn.Double(tableMisc.Rows[m]["value"].ToString()); } } par.AddText(Lan.g("FormRpStatement", "Payment Plan Amount Due: ") + payPlanDue.ToString("c")); //PatGuar.PayPlanDue.ToString("c")); MigraDocHelper.InsertSpacer(section, 10); } #endregion PayPlan grid //Body Table definition-------------------------------------------------------------------------------------------------------- #region Body Table definition ODGrid gridPat = new ODGrid(); //this.Controls.Add(gridPat); gridPat.BeginUpdate(); gridPat.Columns.Clear(); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Date"), 73); gridPat.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Patient"), 100); gridPat.Columns.Add(gcol); //prov gcol = new ODGridColumn(Lan.g("FormRpStatement", "Code"), 45); gridPat.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Tooth"), 42); gridPat.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Description"), 270); gridPat.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Charges"), 60, HorizontalAlignment.Right); gridPat.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Credits"), 60, HorizontalAlignment.Right); gridPat.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Balance"), 60, HorizontalAlignment.Right); gridPat.Columns.Add(gcol); gridPat.Width = gridPat.WidthAllColumns + 20; gridPat.EndUpdate(); #endregion Body Table definition //Loop through each table. Could be one intermingled, or one for each patient----------------------------------------- DataTable tableAccount; string tablename; long patnum; for (int i = 0; i < dataSet.Tables.Count; i++) { tableAccount = dataSet.Tables[i]; tablename = tableAccount.TableName; if (!tablename.StartsWith("account")) { continue; } par = section.AddParagraph(); par.Format.Font = MigraDocHelper.CreateFont(10, true); par.Format.SpaceBefore = Unit.FromInch(.05); par.Format.SpaceAfter = Unit.FromInch(.05); patnum = 0; if (tablename != "account") //account123 etc. { patnum = PIn.Long(tablename.Substring(7)); } if (patnum != 0) { par.AddText(fam.GetNameInFamFLnoPref(patnum)); } //if(FamilyStatementDataList[famIndex].PatAboutList[i].ApptDescript!=""){ // par=section.AddParagraph(); // par.Format.Font=MigraDocHelper.CreateFont(9);//same as body font // par.AddText(FamilyStatementDataList[famIndex].PatAboutList[i].ApptDescript); //} gridPat.BeginUpdate(); gridPat.Rows.Clear(); //lineData=FamilyStatementDataList[famIndex].PatDataList[i].PatData; for (int p = 0; p < tableAccount.Rows.Count; p++) { grow = new ODGridRow(); grow.Cells.Add(tableAccount.Rows[p]["date"].ToString()); grow.Cells.Add(tableAccount.Rows[p]["patient"].ToString()); grow.Cells.Add(tableAccount.Rows[p]["ProcCode"].ToString()); grow.Cells.Add(tableAccount.Rows[p]["tth"].ToString()); if (CultureInfo.CurrentCulture.Name == "en-AU") //English (Australia) { if (tableAccount.Rows[p]["prov"].ToString().Trim() != "") { grow.Cells.Add(tableAccount.Rows[p]["prov"].ToString() + " - " + tableAccount.Rows[p]["description"].ToString()); } else //No provider on this account row item, so don't put the extra leading characters. { grow.Cells.Add(tableAccount.Rows[p]["description"].ToString()); } } else //Assume English (United States) { grow.Cells.Add(tableAccount.Rows[p]["description"].ToString()); } grow.Cells.Add(tableAccount.Rows[p]["charges"].ToString()); grow.Cells.Add(tableAccount.Rows[p]["credits"].ToString()); grow.Cells.Add(tableAccount.Rows[p]["balance"].ToString()); gridPat.Rows.Add(grow); } gridPat.EndUpdate(); MigraDocHelper.DrawGrid(section, gridPat); //Total frame = MigraDocHelper.CreateContainer(section); font = MigraDocHelper.CreateFont(9, true); float totalPos = ((float)(doc.DefaultPageSetup.PageWidth.Inch //-doc.DefaultPageSetup.LeftMargin.Inch //-doc.DefaultPageSetup.RightMargin.Inch) ) * 100f) / 2f + (float)gridPat.WidthAllColumns / 2f + 7; RectangleF rectF = new RectangleF(0, 0, totalPos, 16); if (patnum != 0) { MigraDocHelper.DrawString(frame, " ", //I decided this was unnecessary: //dataSet.Tables["patient"].Rows[fam.GetIndex(patnum)]["balance"].ToString(), font, rectF, ParagraphAlignment.Right); //MigraDocHelper.DrawString(frame,FamilyStatementDataList[famIndex].PatAboutList[i].Balance.ToString("F"),font,rectF, // ParagraphAlignment.Right); } } gridPat.Dispose(); //Future appointments--------------------------------------------------------------------------------------------- #region Future appointments font = MigraDocHelper.CreateFont(9); DataTable tableAppt = dataSet.Tables["appts"]; if (tableAppt.Rows.Count > 0) { par = section.AddParagraph(); par.Format.Font = font; par.AddText(Lan.g("FormRpStatement", "Scheduled Appointments:")); } for (int i = 0; i < tableAppt.Rows.Count; i++) { par.AddLineBreak(); par.AddText(tableAppt.Rows[i]["descript"].ToString()); } if (tableAppt.Rows.Count > 0) { MigraDocHelper.InsertSpacer(section, 10); } #endregion Future appointments //Note------------------------------------------------------------------------------------------------------------ font = MigraDocHelper.CreateFont(9); par = section.AddParagraph(); par.Format.Font = font; par.AddText(Stmt.Note); //bold note if (Stmt.NoteBold != "") { MigraDocHelper.InsertSpacer(section, 10); font = MigraDocHelper.CreateFont(10, true, System.Drawing.Color.DarkRed); par = section.AddParagraph(); par.Format.Font = font; par.AddText(Stmt.NoteBold); } //return doc; }