public Table(decimal width = 1000, int indentation = 0, short marginLeft = 0, short marginRight = 0) { _Table = new _Table(); _TableProperties _tp = new _TableProperties(); _TableWidth _tw = new _TableWidth() { Width = width.ToString(), Type = _TableWidthUnitValues.Dxa }; _tp.Append(_tw); _TableIndentation _ti = new _TableIndentation() { Width = indentation, Type = _TableWidthUnitValues.Dxa }; _tp.Append(_ti); _TableCellMarginDefault _md = new _TableCellMarginDefault(); _TableCellLeftMargin _lm = new _TableCellLeftMargin() { Width = marginLeft, Type = _TableWidthValues.Dxa }; _TableCellRightMargin _rm = new _TableCellRightMargin() { Width = marginRight, Type = _TableWidthValues.Dxa }; _md.Append(_lm); _md.Append(_rm); _Table.Append(_tp); }
internal override OpenXmlElement Render(int index, bool isFirst, bool isLast) { var result = new DocumentFormat.OpenXml.Wordprocessing.Table(_config.GetTableProperties()); foreach (var row in _config.Rows.AsIndexed()) { result.AppendChild(row.Value.Render(row.Index, row.IsFirst, row.IsLast)); } return(result); }
//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); } }