private void CreateDoc(ValueRange vr) { weight = 0; bool secondPage = false; int amountContPage1 = 0; int amounrContPage2 = 0; for (int i = 0; i < vr.Values.Count; i++) { weight += double.Parse(vr.Values[i][5].ToString(), CultureInfo.CreateSpecificCulture("uk-UA")); } string strWeight = weight.ToString("#,#.##", CultureInfo.CreateSpecificCulture("uk-UA")); if (vr.Values.Count > 22) { secondPage = true; amountContPage1 = 22; amounrContPage2 = vr.Values.Count - 22; } else { amountContPage1 = vr.Values.Count; } Directory.CreateDirectory(@"" + Properties.Settings.Default["SavingPath"].ToString() + "\\" + linesComboBox.Text + "\\" + vesselsComboBox.Text); DocX document = DocX.Create(@"" + Properties.Settings.Default["SavingPath"].ToString() + "\\" + linesComboBox.Text + "\\" + vesselsComboBox.Text + "\\" + senderComboBox.Text + " - Прч. " + errendNumber.Text + " - " + vr.Values.Count.ToString() + " конт. - " + countryСomboBox.Text + ".docx"); Xceed.Words.NET.Image img; if (arena.Checked == true) { img = document.AddImage(@"logo1.png"); } else { img = document.AddImage(@"UGLv1.jpg"); } Picture p = img.CreatePicture(); p.Height = (int)(138 / 3.2); p.Width = (int)(2207 / 3.2); document.AddHeaders(); Header header = document.Headers.Odd; header.InsertParagraph(" ", false).InsertPicture(p).FontSize(1); document.MarginHeader = 0; document.MarginFooter = 0; document.MarginTop = 20; document.MarginLeft = 70; document.MarginRight = 25; document.AddFooters(); Footer footer = document.Footers.Odd; Table tFooter = footer.InsertTable(2, 4); tFooter.Rows[1].Height = 50; tFooter.Rows[0].Cells[0].Paragraphs.First().IndentationBefore = -2f; tFooter.Rows[0].Cells[0].MarginLeft = 50; tFooter.Rows[0].Cells[3].MarginRight = 10; tFooter.Rows[0].Cells[0].Width = 160; tFooter.Rows[0].Cells[1].Width = 150; tFooter.Rows[0].Cells[2].Width = 150; tFooter.Rows[0].Cells[3].Width = 160; tFooter.Rows[0].Cells[0].Paragraphs.First().Append("Экспедитор").Alignment = Alignment.center; tFooter.Rows[0].Cells[1].Paragraphs.First().Append("Судовой агент").Alignment = Alignment.center; tFooter.Rows[0].Cells[2].Paragraphs.First().Append("Линейный агент").Alignment = Alignment.center; tFooter.Rows[0].Cells[3].Paragraphs.First().Append("Таможня").Alignment = Alignment.center; tFooter.Rows[1].Cells[0].Paragraphs.First().Append("Экспедитор\n").Alignment = Alignment.left; tFooter.Rows[1].Cells[0].Paragraphs[0].Append("Глоба В. Л.\n").Alignment = Alignment.left; tFooter.Rows[1].Cells[0].Paragraphs[0].Append("Тел.050-341-89-12").Alignment = Alignment.left; tFooter.Rows[1].Cells[0].VerticalAlignment = VerticalAlignment.Bottom; foreach (var item in tFooter.Paragraphs) { item.Font("Times New Roman").FontSize(10).Bold(); } document.MarginFooter = 15; Paragraph p1 = document.InsertParagraph(); p1.Append(proforma[0]); if (arena.Checked == true) { p1.Append(proforma[1]).UnderlineStyle(UnderlineStyle.singleLine) .Append(Environment.NewLine).Append(proforma[2]); } else { p1.Append(proforma[29]).UnderlineStyle(UnderlineStyle.singleLine) .Append(Environment.NewLine).Append(proforma[30]); } Paragraph p2 = document.InsertParagraph(); p2.Append(proforma[3] + " ").Append("«" + linesComboBox.Text + "»").UnderlineStyle(UnderlineStyle.singleLine).SpacingAfter(8).Alignment = Alignment.right; Paragraph p3 = document.InsertParagraph(); DateTime date = DateTime.Now; p3.Append(proforma[4] + " " + errendNumber.Text + " от «" + date.Day.ToString("d2") + "» " + months[date.Month - 1] + " " + date.Year + " г." + Environment.NewLine + proforma[5]) .Append(proforma[6]).UnderlineStyle(UnderlineStyle.singleLine).Append(proforma[7]).SpacingAfter(8).Alignment = Alignment.center; Paragraph p4 = document.InsertParagraph(); p4.Append(proforma[8] + " ").Append(senderNameTextBox.Text.ToUpper() + Environment.NewLine).UnderlineStyle(UnderlineStyle.singleLine) .Append(senderAddressTextBox.Text.ToUpper() + Environment.NewLine).UnderlineStyle(UnderlineStyle.singleLine) .Append("Код: " + senderCodTextBox.Text).UnderlineStyle(UnderlineStyle.singleLine) .SpacingAfter(8); Paragraph p5 = document.InsertParagraph(); p5.Append(proforma[9] + " ").Append(receiverComboBox.Text.ToUpper() + Environment.NewLine).UnderlineStyle(UnderlineStyle.singleLine) .Append(receiverAddressTextBox.Text.ToUpper()).UnderlineStyle(UnderlineStyle.singleLine); Table t1 = document.AddTable(5, 2); Xceed.Words.NET.Border b = new Xceed.Words.NET.Border(Xceed.Words.NET.BorderStyle.Tcbs_none, BorderSize.five, 0, System.Drawing.Color.White); t1.SetBorder(TableBorderType.InsideH, b); t1.SetBorder(TableBorderType.InsideV, b); t1.SetBorder(TableBorderType.Bottom, b); t1.SetBorder(TableBorderType.Top, b); t1.SetBorder(TableBorderType.Left, b); t1.SetBorder(TableBorderType.Right, b); t1.Rows[0].Cells[0].Width = 285; t1.Rows[0].Cells[1].MarginRight = 230; t1.Rows[1].Cells[0].Paragraphs.First().Append(proforma[10] + " ").Append("«" + vesselsComboBox.Text.ToUpper() + "»").UnderlineStyle(UnderlineStyle.singleLine).SpacingAfter(8); t1.Rows[1].Cells[1].Paragraphs.First().Append(proforma[11] + " ").Append(voyageComboBox.Text.ToUpper()).UnderlineStyle(UnderlineStyle.singleLine).Append(" " + proforma[12] + " ").Append(seTextBox.Text.ToUpper()).UnderlineStyle(UnderlineStyle.singleLine).Append(" " + proforma[13] + " ").Append(flagTextBox.Text.ToUpper()).UnderlineStyle(UnderlineStyle.singleLine).SpacingAfter(8); t1.Rows[2].Cells[0].Paragraphs.First().Append(proforma[14] + " ").Append(proforma[15]).UnderlineStyle(UnderlineStyle.singleLine).SpacingAfter(8); t1.Rows[2].Cells[1].Paragraphs.First().Append(proforma[16] + " ").Append(podComboBox.Text.ToUpper()).UnderlineStyle(UnderlineStyle.singleLine).SpacingAfter(8); t1.Rows[3].Cells[0].Paragraphs.First().Append(proforma[17] + " ").Append(potComboBox.Text.ToUpper()).UnderlineStyle(UnderlineStyle.singleLine).SpacingAfter(8); t1.Rows[4].Cells[0].Paragraphs.First().Append(proforma[18] + " ").Append(cargoNameСomboBox.Text.ToUpper()).UnderlineStyle(UnderlineStyle.singleLine).SpacingAfter(8); t1.Rows[4].Cells[1].Paragraphs.First().Append(proforma[19] + " ").Append(cargoCodComboBox.Text).UnderlineStyle(UnderlineStyle.singleLine); document.InsertTable(t1); Paragraph p6 = document.InsertParagraph(); p6.Append(proforma[20] + " ").Append(bookingTextBox.Text.ToUpper()).UnderlineStyle(UnderlineStyle.singleLine); Table t2 = document.AddTable(amountContPage1 + 1, 8); t2.Rows[0].Cells[0].MarginLeft = 40; t2.Rows[0].Cells[0].Paragraphs.First().Append("Номер контейнера").Alignment = Alignment.center; t2.Rows[0].Cells[0].Paragraphs.First().IndentationBefore = -1f; t2.Rows[0].Cells[1].Paragraphs.First().Append("Тип").Alignment = Alignment.center; t2.Rows[0].Cells[2].Paragraphs.First().Append("Кол-во Мест").Alignment = Alignment.center; t2.Rows[0].Cells[3].Paragraphs.First().Append("Вес груза нетто").Alignment = Alignment.center; t2.Rows[0].Cells[4].Paragraphs.First().Append("Вес груза брутто").Alignment = Alignment.center; t2.Rows[0].Cells[5].Paragraphs.First().Append("VGM перепро-веренный вес к-ра брутто**").Alignment = Alignment.center; t2.Rows[0].Cells[6].Paragraphs.First().Append("Пломбы").Alignment = Alignment.center; t2.Rows[0].Cells[6].Width = 350; t2.Rows[0].Cells[7].MarginRight = 10; t2.Rows[0].Cells[7].Paragraphs.First().Append("ГТД").Alignment = Alignment.center; for (int i = 0; i < amountContPage1; i++) { t2.Rows[i + 1].Cells[0].Paragraphs.First().Append(vr.Values[i][0].ToString()).Alignment = Alignment.center; t2.Rows[i + 1].Cells[1].Paragraphs.First().Append(contSizeComboBox.Text + contTypeComboBox.Text).Alignment = Alignment.center; t2.Rows[i + 1].Cells[2].Paragraphs.First().Append(vr.Values[i][13].ToString().ToUpper() == "НАВАЛ" || vr.Values[i][13].ToString().ToUpper() == "" ? "НАВАЛ" : vr.Values[i][13].ToString()).Alignment = Alignment.center; t2.Rows[i + 1].Cells[3].Paragraphs.First().Append(vr.Values[i][4].ToString()).Alignment = Alignment.center; t2.Rows[i + 1].Cells[4].Paragraphs.First().Append(vr.Values[i][5].ToString()).Alignment = Alignment.center; t2.Rows[i + 1].Cells[5].Paragraphs.First().Append(vr.Values[i][6].ToString()).Alignment = Alignment.center; if (vr.Values[i].Count == 20) { t2.Rows[i + 1].Cells[6].Paragraphs.First().Append(vr.Values[i][19].ToString()).Alignment = Alignment.center; } else { t2.Rows[i + 1].Cells[6].Paragraphs.First().Append("").Alignment = Alignment.center; } t2.Rows[i + 1].Cells[7].Paragraphs.First().Append(vr.Values[i][2].ToString()).Alignment = Alignment.center; if (vr.Values[i][2].ToString() == "") { t2.Rows[0].Cells[7].Width = 500; } else { t2.Rows[0].Cells[7].Width = 0; } } foreach (var item in t2.Rows[0].Cells) { item.VerticalAlignment = VerticalAlignment.Center; } document.InsertTable(t2); Paragraph p7 = document.InsertParagraph(); p7.Append(proforma[21] + Environment.NewLine + proforma[22]).SpacingAfter(8).Alignment = Alignment.center; Paragraph p8 = document.InsertParagraph(); p8.Append(proforma[23] + " " + vr.Values.Count + "x" + contSizeComboBox.Text + "` контейнер(ов). ").Append("ВЕС " + '\u2013' + " " + strWeight + " кг." + Environment.NewLine).UnderlineStyle(UnderlineStyle.singleLine) .Append(proforma[24]).Append(proforma[25]).UnderlineStyle(UnderlineStyle.singleLine).SetLineSpacing(LineSpacingType.Line, 1.7f); Paragraph p9 = document.InsertParagraph(); p9.Append(proforma[26] + " ").Append("ПРР: " + lineInfTextBox.Text.ToUpper() + ", ГРН" + Environment.NewLine).UnderlineStyle(UnderlineStyle.singleLine) .Append(" "); if (arena.Checked == true) { p9.Append(proforma[27]).UnderlineStyle(UnderlineStyle.singleLine); } else { p9.Append(proforma[31]).UnderlineStyle(UnderlineStyle.singleLine); } foreach (var item in document.Paragraphs) { item.Font("Times New Roman").FontSize(10).Bold(); } document.Paragraphs[2].FontSize(11); if (secondPage) { p9.InsertPageBreakAfterSelf(); Paragraph p10 = document.InsertParagraph(); p10.Append(proforma[28] + " " + errendNumber.Text + " от «" + date.Day.ToString("d2") + "» " + months[date.Month - 1] + " " + date.Year + " г." + Environment.NewLine + proforma[5]) .Append(proforma[6]).UnderlineStyle(UnderlineStyle.singleLine).Append(proforma[7]).SpacingAfter(8).Alignment = Alignment.center; Table t3 = document.AddTable(amounrContPage2 + 1, 8); t3.Rows[0].Cells[0].MarginLeft = 40; t3.Rows[0].Cells[0].Paragraphs.First().Append("Номер контейнера").FontSize(10).Alignment = Alignment.center; t3.Rows[0].Cells[0].Paragraphs.First().IndentationBefore = -1f; t3.Rows[0].Cells[1].Paragraphs.First().Append("Тип").FontSize(10).Alignment = Alignment.center; t3.Rows[0].Cells[2].Paragraphs.First().Append("Кол-во Мест").FontSize(10).Alignment = Alignment.center; t3.Rows[0].Cells[3].Paragraphs.First().Append("Вес груза нетто").FontSize(10).Alignment = Alignment.center; t3.Rows[0].Cells[4].Paragraphs.First().Append("Вес груза брутто").FontSize(10).Alignment = Alignment.center; t3.Rows[0].Cells[5].Paragraphs.First().Append("VGM перепро-веренный вес к-ра брутто**").FontSize(10).Alignment = Alignment.center; t3.Rows[0].Cells[6].Paragraphs.First().Append("Пломбы").FontSize(10).Alignment = Alignment.center; t3.Rows[0].Cells[6].Width = 350; t3.Rows[0].Cells[7].MarginRight = 10; t3.Rows[0].Cells[7].Paragraphs.First().Append("ГТД").FontSize(10).Alignment = Alignment.center; for (int i = 0; i < amounrContPage2; i++) { t3.Rows[i + 1].Cells[0].Paragraphs.First().Append(vr.Values[i + 22][0].ToString()).FontSize(10).Alignment = Alignment.center; t3.Rows[i + 1].Cells[1].Paragraphs.First().Append(contSizeComboBox.Text + contTypeComboBox.Text).FontSize(10).Alignment = Alignment.center; t3.Rows[i + 1].Cells[2].Paragraphs.First().Append(vr.Values[i + 22][13].ToString().ToUpper() == "НАВАЛ" || vr.Values[i + 22][13].ToString().ToUpper() == "" ? "НАВАЛ" : vr.Values[i + 22][13].ToString()).FontSize(10).Alignment = Alignment.center; t3.Rows[i + 1].Cells[3].Paragraphs.First().Append(vr.Values[i + 22][4].ToString()).FontSize(10).Alignment = Alignment.center; t3.Rows[i + 1].Cells[4].Paragraphs.First().Append(vr.Values[i + 22][5].ToString()).FontSize(10).Alignment = Alignment.center; t3.Rows[i + 1].Cells[5].Paragraphs.First().Append(vr.Values[i + 22][6].ToString()).FontSize(10).Alignment = Alignment.center; if (vr.Values[i].Count == 20) { t3.Rows[i + 1].Cells[6].Paragraphs.First().Append(vr.Values[i + 22][19].ToString()).FontSize(10).Alignment = Alignment.center; } else { t3.Rows[i + 1].Cells[6].Paragraphs.First().Append("").FontSize(10).Alignment = Alignment.center; } t3.Rows[i + 1].Cells[7].Paragraphs.First().Append(vr.Values[i + 22][2].ToString()).FontSize(10).Alignment = Alignment.center; if (vr.Values[i + 22][2].ToString() == "") { t3.Rows[0].Cells[7].Width = 500; } else { t3.Rows[0].Cells[7].Width = 0; } } foreach (var item in t3.Rows[0].Cells) { item.VerticalAlignment = VerticalAlignment.Center; } document.InsertTable(t3); Paragraph p11 = document.InsertParagraph(); p11.Append(proforma[21] + Environment.NewLine + proforma[22]).SpacingAfter(8).FontSize(10).Alignment = Alignment.center; Paragraph p12 = document.InsertParagraph(); p12.Append(proforma[23] + " " + vr.Values.Count + "x" + contSizeComboBox.Text + "` контейнер(ов)." + " ").FontSize(10).Append("ВЕС " + '\u2013' + " " + strWeight + " кг." + Environment.NewLine).UnderlineStyle(UnderlineStyle.singleLine).FontSize(10) .Append(proforma[24]).FontSize(10).Append(proforma[25]).FontSize(10).UnderlineStyle(UnderlineStyle.singleLine).SetLineSpacing(LineSpacingType.Line, 1.7f); Paragraph p13 = document.InsertParagraph(); p13.Append(proforma[26] + " ").FontSize(10).Append("ПРР: " + lineInfTextBox.Text + ", ГРН" + Environment.NewLine).FontSize(10).UnderlineStyle(UnderlineStyle.singleLine) .Append(" ").FontSize(10); if (arena.Checked == true) { p9.Append(proforma[27]).FontSize(10).UnderlineStyle(UnderlineStyle.singleLine); } else { p9.Append(proforma[31]).FontSize(10).UnderlineStyle(UnderlineStyle.singleLine); } foreach (var item in document.Paragraphs) { item.Font("Times New Roman").Bold(); } secondPage = false; } try { document.Save(); Process.Start(@"" + Properties.Settings.Default["SavingPath"].ToString() + "\\" + linesComboBox.Text + "\\" + vesselsComboBox.Text + "\\" + senderComboBox.Text + " - Прч. " + errendNumber.Text + " - " + vr.Values.Count.ToString() + " конт. - " + countryСomboBox.Text + ".docx"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void BtnWord_Click(object sender, EventArgs e) { if (DtpFechaCobroHasta.Value.Month == 1) { mes = "Enero"; } else if (DtpFechaCobroHasta.Value.Month == 2) { mes = "Febrero"; } else if (DtpFechaCobroHasta.Value.Month == 3) { mes = "Marzo"; } else if (DtpFechaCobroHasta.Value.Month == 4) { mes = "Abril"; } else if (DtpFechaCobroHasta.Value.Month == 5) { mes = "Mayo"; } else if (DtpFechaCobroHasta.Value.Month == 6) { mes = "Junio"; } else if (DtpFechaCobroHasta.Value.Month == 7) { mes = "Julio"; } else if (DtpFechaCobroHasta.Value.Month == 8) { mes = "Agosto"; } else if (DtpFechaCobroHasta.Value.Month == 9) { mes = "Septiembre"; } else if (DtpFechaCobroHasta.Value.Month == 10) { mes = "Octubre"; } else if (DtpFechaCobroHasta.Value.Month == 11) { mes = "Noviembre"; } else if (DtpFechaCobroHasta.Value.Month == 12) { mes = "Diciembre"; } try { if (CbFechaCobroDesde.Text == "") { MessageBox.Show("Seleccionar la Fecha DESDE antes de pasar el Reporte a Documento Word!"); } else { string path = @"c:\ReportePagos2\"; if (Directory.Exists(path)) { using (var document = DocX.Create(path + "ReportePagoWord.docx")) { document.InsertParagraph("Pago Servicios Profesional").Font(new Xceed.Words.NET.Font("Times New Roman")) .FontSize(20d).Color(Color.Blue).Bold().Alignment = Alignment.center; document.InsertParagraph(); string SueldoEscrito = ""; decimal nletra = Convert.ToDecimal(SueldoEscrito); SueldoEscrito = nletra.Numeroletras(); document.InsertParagraph("Yo " + TbNombres.Text + " " + TbApellidos.Text + " certifico haber recibido el depósito en el Banco " + TbBanco.Text + " a la cuenta No. " + TbCuentaBanco.Text + " por la cantidad de dinero RD$" + TbTotalCobrar.Text + " (" + SueldoEscrito + ")" + " correspondiente al pago de Servicios Profesionales prestados en el periodo desde " + CbFechaCobroDesde.Text + " al " + DtpFechaCobroHasta.Value.Day.ToString() + " de " + mes + " del " + DtpFechaCobroHasta.Value.Year.ToString() + " año de contrato vigente.").Font(new Xceed.Words.NET.Font("Times New Roman")).Color(Color.Blue); document.InsertParagraph(); document.InsertParagraph("Ajuste por Descuento TSS contributiva 6 % correspondiente al periodo aquí pagado por" + " un monto RD$" + TbMontoRetencion.Text).Font(new Xceed.Words.NET.Font("Times New Roman")).Color(Color.Blue); document.InsertParagraph(); document.InsertParagraph("Detalle de Pago de Quincena.").Font(new Xceed.Words.NET.Font("Times New Roman")).Color(Color.Blue); document.InsertParagraph(); //Cuadro var table = document.InsertTable(1, 4); table.AutoFit = AutoFit.Window; var border = new Xceed.Words.NET.Border(Xceed.Words.NET.BorderStyle.Tcbs_single, BorderSize.one, 0, Color.Black); table.SetBorder(TableBorderType.InsideH, border); table.SetBorder(TableBorderType.Bottom, border); table.SetBorder(TableBorderType.InsideV, border); table.SetBorder(TableBorderType.Left, border); table.SetBorder(TableBorderType.Right, border); table.SetBorder(TableBorderType.Top, border); var tableHeader = table.Rows[0]; tableHeader.Cells[0].InsertParagraph().Append("Fecha").Color(Color.Blue).Bold(); tableHeader.Cells[1].InsertParagraph().Append("Monto").Color(Color.Blue).Bold(); tableHeader.Cells[2].InsertParagraph().Append("Impuesto").Color(Color.Blue).Bold(); tableHeader.Cells[3].InsertParagraph().Append("Neto").Color(Color.Blue).Bold(); ///Desde 01 al 15 de julio del 2018 var tableRow = table.InsertRow(); tableRow.Cells[0].InsertParagraph().Append("Desde " + CbFechaCobroDesde.Text + " al " + DtpFechaCobroHasta.Value.Day.ToString() + " de " + DtpFechaCobroHasta.Value.Month.ToString() + " del " + DtpFechaCobroHasta.Value.Year.ToString()).Color(Color.Blue); if (TbSeguroSalud.Text == "" || TbSeguroSalud.Text == "0") { } else { tableRow.Cells[0].InsertParagraph().Append("____________________________"); tableRow.Cells[0].InsertParagraph().Append("Seguro de Salud").Color(Color.Blue); } if (TbHorasExtras.Text == "" || TbHorasExtras.Text == "0") { } else { tableRow.Cells[0].InsertParagraph().Append("____________________________"); tableRow.Cells[0].InsertParagraph().Append("Horas Extras").Color(Color.Blue); } if (TbBonoEspecial.Text == "" || TbBonoEspecial.Text == "0") { } else { tableRow.Cells[0].InsertParagraph().Append("____________________________"); tableRow.Cells[0].InsertParagraph().Append("Bono Especial").Color(Color.Blue); } if (adicional == "" || adicional == "0") { } else { tableRow.Cells[0].InsertParagraph().Append("____________________________"); tableRow.Cells[0].InsertParagraph().Append("Adicional").Color(Color.Blue); } if (TbReembolsoGastos.Text == "" || TbReembolsoGastos.Text == "0") { } else { tableRow.Cells[0].InsertParagraph().Append("____________________________"); tableRow.Cells[0].InsertParagraph().Append("Reembolso de Gastos").Color(Color.Blue); } tableRow.Cells[0].InsertParagraph().Append("____________________________"); tableRow.Cells[0].InsertParagraph().Append("TOTAL").Color(Color.Blue).Bold(); tableRow.Cells[1].InsertParagraph().Append("RD$" + TbSueldoFijo.Text).Color(Color.Blue); tableRow.Cells[1].InsertParagraph().Append("____________________________"); tableRow.Cells[2].InsertParagraph().Append("RD$" + TbMontoRetencion.Text).Color(Color.Blue); tableRow.Cells[2].InsertParagraph().Append("________"); decimal sueldoneto = Convert.ToDecimal(TbSueldoFijo.Text) - Convert.ToDecimal(TbMontoRetencion.Text); Convert.ToString(sueldoneto); tableRow.Cells[3].InsertParagraph().Append("RD$" + sueldoneto).Color(Color.Blue); if (TbSeguroSalud.Text == "" || TbSeguroSalud.Text == "0") { } else { tableRow.Cells[3].InsertParagraph().Append("___________"); tableRow.Cells[3].InsertParagraph().Append("RD$" + TbSeguroSalud.Text).Color(Color.Blue); } if (TbHorasExtras.Text == "" || TbHorasExtras.Text == "0") { } else { tableRow.Cells[3].InsertParagraph().Append("___________"); tableRow.Cells[3].InsertParagraph().Append("RD$" + TbHorasExtras.Text).Color(Color.Blue); } if (TbBonoEspecial.Text == "" || TbBonoEspecial.Text == "0") { } else { tableRow.Cells[3].InsertParagraph().Append("___________"); tableRow.Cells[3].InsertParagraph().Append("RD$" + TbBonoEspecial.Text).Color(Color.Blue); } if (adicional == "" || adicional == "0") { } else { tableRow.Cells[3].InsertParagraph().Append("___________"); tableRow.Cells[3].InsertParagraph().Append("RD$" + adicional).Color(Color.Blue); } if (TbReembolsoGastos.Text == "" || TbReembolsoGastos.Text == "0") { } else { tableRow.Cells[3].InsertParagraph().Append("___________"); tableRow.Cells[3].InsertParagraph().Append("RD$" + TbReembolsoGastos.Text).Color(Color.Blue); } tableRow.Cells[3].InsertParagraph().Append("___________"); tableRow.Cells[3].InsertParagraph().Append("RD$" + TbTotalCobrar.Text).Color(Color.Blue); document.InsertParagraph(); document.InsertParagraph("Hecho y firmado en Santo Domingo, Distrito Nacional de la República Dominicana, a los " + "(" + DtpFechaCobroHasta.Value.Day.ToString() + ")" + " días del mes de " + mes + " del año " + DtpFechaCobroHasta.Value.Year.ToString()).Font(new Xceed.Words.NET.Font("Times New Roman")).Color(Color.Blue); document.InsertParagraph(); document.InsertParagraph("_________________________________ ___________________________________").Color(Color.Blue); document.InsertParagraph("Sr. " + TbNombres.Text + " " + TbApellidos.Text + " " + "Sr. José Abraham Cocco Risk") .Font(new Xceed.Words.NET.Font("Times New Roman")) .Color(Color.Blue); document.Save(); MessageBox.Show("Documento listo!"); } } } } catch (Exception) { MessageBox.Show("Cerrar el Documento y Intentarlo nuevamente!"); } }