Example #1
0
 public ListBuilder(IT.IDocListener document)
 {
     if (document == null) {
     throw new System.ArgumentNullException("document", "document cannot be null." );
      }
      this.document = document;
 }
Example #2
0
 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;
        }
Example #4
0
 //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);
     }
 }
Example #5
0
 /* ----------------------------------------------------------------- */
 /// 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);
 }
Example #6
0
 /* ----------------------------------------------------------------- */
 /// 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;
 }
Example #7
0
        /* ----------------------------------------------------------------- */
        ///
        /// 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);
        }
Example #8
0
        /* ----------------------------------------------------------------- */
        /// 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);
        }
Example #9
0
 /* ----------------------------------------------------------------- */
 /// 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;
         }
     }
 }
Example #10
0
 public tWords(string text, int alignment, it.Font font)
 {
     Text = text;
     Alignment = alignment;
     Font = font;
 }