private void AddCell(DocumentFormat.OpenXml.Wordprocessing.TableRow tr, string text)
 {
     DocumentFormat.OpenXml.Wordprocessing.TableCell tc = new DocumentFormat.OpenXml.Wordprocessing.TableCell(
         new DocumentFormat.OpenXml.Wordprocessing.Paragraph(
             new DocumentFormat.OpenXml.Wordprocessing.Run(
                 new DocumentFormat.OpenXml.Wordprocessing.Text(text))));
     tr.Append(tc);
 }
Ejemplo n.º 2
0
        public TableRow(uint height)
        {
            _TableRow = new _TableRow();
            _TableRowProperties _trp = new _TableRowProperties();

            _TableRowHeight _trh = new _TableRowHeight()
            {
                Val = height
            };

            _trp.Append(_trh);

            _TableRow.Append(_trp);
        }
        //public void ConvertTopdf(string path, string filename)
        //{
        //    SautinSoft.UseOffice u = new SautinSoft.UseOffice();
        //    if (u.InitWord() == 0)
        //    {
        //        //convert Word (RTF, DOC, DOCX to PDF)
        //        u.ConvertFile(path, @"I:\karthik\pdf\pdf\" + filename, SautinSoft.UseOffice.eDirection.DOC_to_PDF);
        //    }
        //    u.CloseOffice();
        //}

        private void AddWordCell(Dictionary <int, string> selectedMonthList, List <EmailPaymentEntity> emailPaymentList, Table table)
        {
            foreach (int month in selectedMonthList.Keys)
            {
                DocumentFormat.OpenXml.Wordprocessing.TableRow tr =
                    new DocumentFormat.OpenXml.Wordprocessing.TableRow();
                AddCell(tr, selectedMonthList[month]);

                foreach (EmailPaymentEntity emailPaymentEntity in emailPaymentList)
                {
                    if (emailPaymentEntity.Month == month)
                    {
                        switch ((PaymentTypeEnum)emailPaymentEntity.PaymentTypeId)
                        {
                        case PaymentTypeEnum.Okul:
                            AddCell(tr, emailPaymentEntity.AmountDescription);
                            break;

                        case PaymentTypeEnum.None:
                            break;

                        case PaymentTypeEnum.Servis:
                            AddCell(tr, emailPaymentEntity.AmountDescription);
                            break;

                        case PaymentTypeEnum.Kirtasiye:
                            AddCell(tr, emailPaymentEntity.AmountDescription);
                            break;

                        case PaymentTypeEnum.Mental:
                            AddCell(tr, emailPaymentEntity.AmountDescription);
                            break;

                        case PaymentTypeEnum.Diger:
                            AddCell(tr, emailPaymentEntity.AmountDescription);
                            break;

                        default:
                            break;
                        }
                    }
                }

                table.Append(tr);
            }
        }