コード例 #1
0
ファイル: ColumnText.cs プロジェクト: pixelia-es/RazorPDF2
 /**
  * Replaces the current text array with this <CODE>Phrase</CODE>.
  * Anything added previously with AddElement() is lost.
  * @param phrase the text
  */
 public void SetText(Phrase phrase)
 {
     bidiLine = null;
     composite = false;
     compositeColumn = null;
     compositeElements = null;
     listIdx = 0;
     splittedRow = false;
     waitPhrase = phrase;
 }
コード例 #2
0
ファイル: ColumnText.cs プロジェクト: pixelia-es/RazorPDF2
 /** Makes this instance an independent copy of <CODE>org</CODE>.
  * @param org the original <CODE>ColumnText</CODE>
  * @return itself
  */
 public ColumnText SetACopy(ColumnText org)
 {
     SetSimpleVars(org);
     if (org.bidiLine != null)
     bidiLine = new BidiLine(org.bidiLine);
     return this;
 }
コード例 #3
0
ファイル: ColumnText.cs プロジェクト: pixelia-es/RazorPDF2
 private void AddWaitingPhrase()
 {
     if (bidiLine == null && waitPhrase != null) {
     bidiLine = new BidiLine();
     foreach (Chunk ck in waitPhrase.Chunks) {
         bidiLine.AddChunk(new PdfChunk(ck, null));
     }
     waitPhrase = null;
     }
 }
コード例 #4
0
ファイル: ColumnText.cs プロジェクト: pixelia-es/RazorPDF2
 /**
  * Adds an element. Elements supported are <CODE>Paragraph</CODE>,
  * <CODE>List</CODE>, <CODE>PdfPTable</CODE>, <CODE>Image</CODE> and
  * <CODE>Graphic</CODE>.
  * <p>
  * It removes all the text placed with <CODE>addText()</CODE>.
  * @param element the <CODE>Element</CODE>
  */
 public void AddElement(IElement element)
 {
     if (element == null)
     return;
     if (element is Image) {
     Image img = (Image)element;
     PdfPTable t = new PdfPTable(1);
     float w = img.WidthPercentage;
     if (w == 0) {
         t.TotalWidth = img.ScaledWidth;
         t.LockedWidth = true;
     }
     else
         t.WidthPercentage = w;
     t.SpacingAfter = img.SpacingAfter;
     t.SpacingBefore = img.SpacingBefore;
     switch (img.Alignment) {
         case Image.LEFT_ALIGN:
             t.HorizontalAlignment = Element.ALIGN_LEFT;
             break;
         case Image.RIGHT_ALIGN:
             t.HorizontalAlignment = Element.ALIGN_RIGHT;
             break;
         default:
             t.HorizontalAlignment = Element.ALIGN_CENTER;
             break;
     }
     PdfPCell c = new PdfPCell(img, true);
     c.Padding = 0;
     c.Border = img.Border;
     c.BorderColor = img.BorderColor;
     c.BorderWidth = img.BorderWidth;
     c.BackgroundColor = img.BackgroundColor;
     t.AddCell(c);
     element = t;
     }
     if (element.Type == Element.CHUNK) {
     element = new Paragraph((Chunk)element);
     }
     else if (element.Type == Element.PHRASE) {
     element = new Paragraph((Phrase)element);
     }
     if (element is SimpleTable) {
     try {
         element = ((SimpleTable)element).CreatePdfPTable();
     } catch (DocumentException) {
         throw new ArgumentException("Element not allowed.");
     }
     }
     else if (element.Type != Element.PARAGRAPH && element.Type != Element.LIST && element.Type != Element.PTABLE && element.Type != Element.YMARK)
     throw new ArgumentException("Element not allowed.");
     if (!composite) {
     composite = true;
     compositeElements = new ArrayList();
     bidiLine = null;
     waitPhrase = null;
     }
     compositeElements.Add(element);
 }
コード例 #5
0
ファイル: BidiLine.cs プロジェクト: pixelia-es/RazorPDF2
        public BidiLine(BidiLine org)
        {
            runDirection = org.runDirection;
            pieceSize = org.pieceSize;
            text = (char[])org.text.Clone();
            detailChunks = (PdfChunk[])org.detailChunks.Clone();
            totalTextLength = org.totalTextLength;

            orderLevels = (byte[])org.orderLevels.Clone();
            indexChars = (int[])org.indexChars.Clone();

            chunks = new ArrayList(org.chunks);
            indexChunk = org.indexChunk;
            indexChunkChar = org.indexChunkChar;
            currentChar = org.currentChar;

            storedRunDirection = org.storedRunDirection;
            storedText = (char[])org.storedText.Clone();
            storedDetailChunks = (PdfChunk[])org.storedDetailChunks.Clone();
            storedTotalTextLength = org.storedTotalTextLength;

            storedOrderLevels = (byte[])org.storedOrderLevels.Clone();
            storedIndexChars = (int[])org.storedIndexChars.Clone();

            storedIndexChunk = org.storedIndexChunk;
            storedIndexChunkChar = org.storedIndexChunkChar;
            storedCurrentChar = org.storedCurrentChar;

            shortStore = org.shortStore;
            arabicOptions = org.arabicOptions;
        }