本文整理匯總了C#中iTextSharp.text.pdf.PdfLine.ResetAlignment方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfLine.ResetAlignment方法的具體用法?C# PdfLine.ResetAlignment怎麽用?C# PdfLine.ResetAlignment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PdfLine
的用法示例。
在下文中一共展示了PdfLine.ResetAlignment方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: PdfCell
// constructors
/**
* Constructs a <CODE>PdfCell</CODE>-object.
*
* @param cell the original <CODE>Cell</CODE>
* @param rownumber the number of the <CODE>Row</CODE> the <CODE>Cell</CODE> was in.
* @param left the left border of the <CODE>PdfCell</CODE>
* @param right the right border of the <CODE>PdfCell</CODE>
* @param top the top border of the <CODE>PdfCell</CODE>
* @param cellspacing the cellspacing of the <CODE>Table</CODE>
* @param cellpadding the cellpadding of the <CODE>Table</CODE>
*/
public PdfCell(Cell cell, int rownumber, float left, float right, float top, float cellspacing, float cellpadding)
: base(left, top, right, top)
{
// copying the other Rectangle attributes from class Cell
CloneNonPositionParameters(cell);
this.cellpadding = cellpadding;
this.cellspacing = cellspacing;
this.verticalAlignment = cell.VerticalAlignment;
this.useAscender = cell.UseAscender;
this.useDescender = cell.UseDescender;
this.useBorderPadding = cell.UseBorderPadding;
// initialisation of some parameters
PdfChunk chunk;
PdfChunk overflow;
lines = new ArrayList();
images = new ArrayList();
leading = cell.Leading;
int alignment = cell.HorizontalAlignment;
left += cellspacing + cellpadding;
right -= cellspacing + cellpadding;
left += GetBorderWidthInside(LEFT_BORDER);
right -= GetBorderWidthInside(RIGHT_BORDER);
contentHeight = 0;
rowspan = cell.Rowspan;
ArrayList allActions;
int aCounter;
// we loop over all the elements of the cell
foreach (IElement ele in cell.Elements) {
switch (ele.Type) {
case Element.JPEG:
case Element.IMGRAW:
case Element.IMGTEMPLATE:
AddImage((Image)ele, left, right, 0.4f * leading, alignment);
break;
// if the element is a list
case Element.LIST:
if (line != null && line.Size > 0) {
line.ResetAlignment();
AddLine(line);
}
allActions = new ArrayList();
ProcessActions(ele, null, allActions);
aCounter = 0;
// we loop over all the listitems
foreach (ListItem item in ((List)ele).Items) {
line = new PdfLine(left + item.IndentationLeft, right, alignment, item.Leading);
line.ListItem = item;
foreach (Chunk c in item.Chunks) {
chunk = new PdfChunk(c, (PdfAction)(allActions[aCounter++]));
while ((overflow = line.Add(chunk)) != null) {
AddLine(line);
line = new PdfLine(left + item.IndentationLeft, right, alignment, item.Leading);
chunk = overflow;
}
line.ResetAlignment();
AddLine(line);
line = new PdfLine(left + item.IndentationLeft, right, alignment, leading);
}
}
line = new PdfLine(left, right, alignment, leading);
break;
// if the element is something else
default:
allActions = new ArrayList();
ProcessActions(ele, null, allActions);
aCounter = 0;
float currentLineLeading = leading;
float currentLeft = left;
float currentRight = right;
if (ele is Phrase) {
currentLineLeading = ((Phrase) ele).Leading;
}
if (ele is Paragraph) {
Paragraph p = (Paragraph) ele;
currentLeft += p.IndentationLeft;
currentRight -= p.IndentationRight;
}
if (line == null) {
line = new PdfLine(currentLeft, currentRight, alignment, currentLineLeading);
}
// we loop over the chunks
ArrayList chunks = ele.Chunks;
if (chunks.Count == 0) {
AddLine(line); // add empty line - all cells need some lines even if they are empty
//.........這裏部分代碼省略.........
示例2: AddList
private void AddList(List list, float left, float right, int alignment) {
PdfChunk chunk;
PdfChunk overflow;
ArrayList allActions = new ArrayList();
ProcessActions(list, null, allActions);
int aCounter = 0;
foreach (IElement ele in list.Items) {
switch (ele.Type) {
case Element.LISTITEM:
ListItem item = (ListItem)ele;
line = new PdfLine(left + item.IndentationLeft, right, alignment, item.Leading);
line.ListItem = item;
foreach (Chunk c in item.Chunks) {
chunk = new PdfChunk(c, (PdfAction)(allActions[aCounter++]));
while ((overflow = line.Add(chunk)) != null) {
AddLine(line);
line = new PdfLine(left + item.IndentationLeft, right, alignment, item.Leading);
chunk = overflow;
}
line.ResetAlignment();
AddLine(line);
line = new PdfLine(left + item.IndentationLeft, right, alignment, leading);
}
break;
case Element.LIST:
List sublist = (List)ele;
AddList(sublist, left + sublist.IndentationLeft, right, alignment);
break;
}
}
}