/* (non-Javadoc) * @see com.itextpdf.html2pdf.attach.ITagWorker#getElementResult() */ public virtual IPropertyContainer GetElementResult() { TableWrapper tableWrapper = new TableWrapper(); foreach (Cell cell in rowWrapper.GetCells()) { tableWrapper.AddCell(cell); } return(tableWrapper.ToTable(null)); }
/* (non-Javadoc) * @see com.itextpdf.html2pdf.attach.ITagWorker#getElementResult() */ public virtual IPropertyContainer GetElementResult() { TableWrapper tableWrapper = new TableWrapper(); foreach (Cell cell in rowWrapper.GetCells()) { AccessiblePropHelper.TrySetLangAttribute(cell, lang); tableWrapper.AddCell(cell); } return(tableWrapper.ToTable(null)); }
/* (non-Javadoc) * @see com.itextpdf.html2pdf.attach.ITagWorker#processTagChild(com.itextpdf.html2pdf.attach.ITagWorker, com.itextpdf.html2pdf.attach.ProcessorContext) */ public virtual bool ProcessTagChild(ITagWorker childTagWorker, ProcessorContext context) { if (childTagWorker is TrTagWorker) { TableRowWrapper wrapper = ((TrTagWorker)childTagWorker).GetTableRowWrapper(); tableWrapper.NewRow(); foreach (Cell cell in wrapper.GetCells()) { tableWrapper.AddCell(cell); } return(true); } else { if (childTagWorker is iText.Html2pdf.Attach.Impl.Tags.TableTagWorker) { if (((iText.Html2pdf.Attach.Impl.Tags.TableTagWorker)childTagWorker).header) { Table header = ((iText.Html2pdf.Attach.Impl.Tags.TableTagWorker)childTagWorker).tableWrapper.ToTable(colgroupsHelper ); String headerLang = header.GetAccessibilityProperties().GetLanguage(); tableWrapper.SetHeaderLang(headerLang); for (int i = 0; i < header.GetNumberOfRows(); i++) { tableWrapper.NewHeaderRow(); for (int j = 0; j < header.GetNumberOfColumns(); j++) { Cell headerCell = header.GetCell(i, j); if (headerCell != null) { tableWrapper.AddHeaderCell(headerCell); } } } return(true); } else { if (((iText.Html2pdf.Attach.Impl.Tags.TableTagWorker)childTagWorker).footer) { Table footer = ((iText.Html2pdf.Attach.Impl.Tags.TableTagWorker)childTagWorker).tableWrapper.ToTable(colgroupsHelper ); String footerLang = footer.GetAccessibilityProperties().GetLanguage(); tableWrapper.SetFooterLang(footerLang); for (int i = 0; i < footer.GetNumberOfRows(); i++) { tableWrapper.NewFooterRow(); for (int j = 0; j < footer.GetNumberOfColumns(); j++) { Cell footerCell = footer.GetCell(i, j); if (footerCell != null) { tableWrapper.AddFooterCell(footerCell); } } } return(true); } } } else { if (childTagWorker is ColgroupTagWorker) { if (colgroupsHelper != null) { colgroupsHelper.Add(((ColgroupTagWorker)childTagWorker).GetColgroup().FinalizeCols()); return(true); } } else { if (childTagWorker is CaptionTagWorker) { tableWrapper.SetCaption((Div)childTagWorker.GetElementResult()); return(true); } } } } return(false); }
/* (non-Javadoc) * @see com.itextpdf.html2pdf.attach.ITagWorker#processTagChild(com.itextpdf.html2pdf.attach.ITagWorker, com.itextpdf.html2pdf.attach.ProcessorContext) */ public virtual bool ProcessTagChild(ITagWorker childTagWorker, ProcessorContext context) { bool displayTableCell = childTagWorker is IDisplayAware && CssConstants.TABLE_CELL.Equals(((IDisplayAware) childTagWorker).GetDisplay()); if (currentRowIsFinished) { tableWrapper.NewRow(); } if (childTagWorker is DisplayTableRowTagWorker) { FlushWaitingCell(); if (!currentRowIsFinished) { tableWrapper.NewRow(); } TableRowWrapper wrapper = ((DisplayTableRowTagWorker)childTagWorker).GetTableRowWrapper(); foreach (Cell cell in wrapper.GetCells()) { tableWrapper.AddCell(cell); } currentRowIsFinished = true; return(true); } else { if (childTagWorker.GetElementResult() is IBlockElement) { IBlockElement childResult = (IBlockElement)childTagWorker.GetElementResult(); Cell curCell = childResult is Cell ? (Cell)childResult : CreateWrapperCell().Add(childResult); ProcessCell(curCell, displayTableCell); currentRowIsFinished = false; return(true); } else { if (childTagWorker.GetElementResult() is ILeafElement) { inlineHelper.Add((ILeafElement)childTagWorker.GetElementResult()); currentRowIsFinished = false; return(true); } else { if (childTagWorker is SpanTagWorker) { // the previous one if (displayTableCell) { FlushWaitingCell(); } bool allChildrenProcessed = true; foreach (IPropertyContainer propertyContainer in ((SpanTagWorker)childTagWorker).GetAllElements()) { if (propertyContainer is ILeafElement) { inlineHelper.Add((ILeafElement)propertyContainer); } else { allChildrenProcessed = false; } } // the current one if (displayTableCell) { FlushWaitingCell(); } currentRowIsFinished = false; return(allChildrenProcessed); } } } } return(false); }