public ListBuilder(IT.IDocListener document) { if (document == null) { throw new System.ArgumentNullException("document", "document cannot be null." ); } this.document = document; }
public ModuleBuilder(IT.IDocListener document, int year, int rowsPerPage) { if (document == null) { throw new System.ArgumentNullException("document", "document cannot be null"); } else { this.document = document; } this.year = year; this.rowsPerPage = rowsPerPage; }
public static IT.Section AddFormattedSection(Section section, IT.Chapter chapter) { IT.Section Formattedsection = chapter.AddSection("Title"); Formattedsection.Title = null; foreach (var item in section.SubElements) { Formattedsection.Add(GetElement(item)); } return Formattedsection; }
//This method is used to add any Element part to the pdf file private void AddToDocument(IT.IElement pdfElement, PDF.MultiColumnText columns) { if (columns != null) { columns.AddElement(pdfElement); if (columns.IsOverflow()) columns.NextColumn(); document.Add(columns); } else { document.Add(pdfElement); } }
/* ----------------------------------------------------------------- */ /// AddSection /* ----------------------------------------------------------------- */ private void AddSection(iText.Section parent, Element element) { var style = (element.Depth == 1) ? _policy.Chapter : _policy.Section; var title = new iText.Paragraph(element.Value, style.Font); title.SpacingAfter = style.Spacing; iText.Section section = (parent == null) ? new iText.Chapter(title, _chapter++) : parent.AddSection(title); section.IndentationLeft = style.Indent; section.TriggerNewPage = style.TriggerNewPage; ++_index; this.AddElements(section); if (parent == null) _doc.Add(section); }
/* ----------------------------------------------------------------- */ /// AddParagraph /* ----------------------------------------------------------------- */ private void AddParagraph(iText.ITextElementArray parent, Element element) { var paragraph = new iText.Paragraph(element.Value,_policy.Paragraph.Font); paragraph.IndentationLeft = _policy.Paragraph.Indent; paragraph.FirstLineIndent = _policy.Paragraph.FirstLineIndent; paragraph.SpacingAfter = _policy.Paragraph.Spacing; parent.Add(paragraph); ++_index; }
/* ----------------------------------------------------------------- */ /// /// AddNumericList /// /// <summary> /// NOTE: 行間は,各種要素 (Paragraph, Section, List, NumericList) /// の末尾に空白を取る事で調整する.そのため,リストの最後の項目に /// 空白を挿入している. /// </summary> /// /* ----------------------------------------------------------------- */ private void AddNumericList(iText.ITextElementArray parent, Element element) { var list = new iText.List(true, _policy.NumericList.SymbolIndent); list.IndentationLeft = _policy.NumericList.Indent; while (_index < _parser.Elements.Count && _parser.Elements[_index].Type == element.Type) { var item = new iText.Paragraph(_parser.Elements[_index].Value, _policy.NumericList.Font); ++_index; if (_index >= _parser.Elements.Count || _parser.Elements[_index].Type != element.Type) { item.SpacingAfter = _policy.NumericList.Spacing; } list.Add(new iText.ListItem(item)); } parent.Add(list); }
/* ----------------------------------------------------------------- */ /// AddImage /* ----------------------------------------------------------------- */ private void AddImage(iText.ITextElementArray parent, Element element) { var path = Path.IsPathRooted(element.Value) ? element.Value : Path.GetFullPath(element.Value); ++_index; if (!File.Exists(path)) return; var image = iText.Image.GetInstance(path); image.Alignment = _policy.Image.Alignment; image.SetDpi(_policy.Image.DPI, _policy.Image.DPI); parent.Add(image); }
/* ----------------------------------------------------------------- */ /// AddElements /* ----------------------------------------------------------------- */ private void AddElements(iText.Section parent) { while (_index < _parser.Elements.Count) { var element = _parser.Elements[_index]; switch (element.Type) { case ElementType.Section: if (parent != null && element.Depth <= parent.Depth) return; this.AddSection(parent, element); break; case ElementType.Paragraph: this.AddParagraph(parent, element); break; case ElementType.List: this.AddList(parent, element); break; case ElementType.NumericList: this.AddNumericList(parent, element); break; case ElementType.Image: this.AddImage(parent, element); break; default: // 未対応のデータ種類 ++_index; break; } } }
public tWords(string text, int alignment, it.Font font) { Text = text; Alignment = alignment; Font = font; }