本文整理汇总了C#中iTextSharp.text.Chunk.Append方法的典型用法代码示例。如果您正苦于以下问题:C# Chunk.Append方法的具体用法?C# Chunk.Append怎么用?C# Chunk.Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp.text.Chunk
的用法示例。
在下文中一共展示了Chunk.Append方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
/**
* Adds an <CODE>Object</CODE> to the <CODE>List</CODE>.
*
* @param o the object to add.
* @return true if adding the object succeeded
*/
public override bool Add(Object o) {
if (o is ListItem) {
ListItem item = (ListItem) o;
Chunk chunk = new Chunk(preSymbol, symbol.Font);
switch (type ) {
case 0:
chunk.Append(((char)(first + list.Count + 171)).ToString());
break;
case 1:
chunk.Append(((char)(first + list.Count + 181)).ToString());
break;
case 2:
chunk.Append(((char)(first + list.Count + 191)).ToString());
break;
default:
chunk.Append(((char)(first + list.Count + 201)).ToString());
break;
}
chunk.Append(postSymbol);
item.ListSymbol = chunk;
item.SetIndentationLeft(symbolIndent, autoindent);
item.IndentationRight = 0;
list.Add(item);
return true;
} else if (o is List) {
List nested = (List) o;
nested.IndentationLeft = nested.IndentationLeft + symbolIndent;
first--;
list.Add(nested);
return true;
} else if (o is String) {
return this.Add(new ListItem((string) o));
}
return false;
}
示例2: Go
public void Go()
{
// GetClassOutputPath() implementation left out for brevity
var outputFile = Helpers.IO.GetClassOutputPath(this);
using (FileStream stream = new FileStream(
outputFile,
FileMode.Create,
FileAccess.Write))
{
Random random = new Random();
StreamUtil.AddToResourceSearch(("iTextAsian.dll"));
string chunkText = " 你好世界 你好你好,";
var font = new Font(BaseFont.CreateFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED), 12);
using (Document document = new Document())
{
PdfWriter.GetInstance(document, stream);
document.Open();
Phrase phrase = new Phrase();
Chunk chunk = new Chunk("", font);
for (var i = 0; i < 1000; ++i)
{
var asterisk = new String('*', random.Next(1, 20));
chunk.Append(
string.Format("[{0}] {1} ", asterisk, chunkText)
);
}
chunk.SetSplitCharacter(new CustomSplitCharacter());
phrase.Add(chunk);
document.Add(phrase);
}
}
}
示例3: Add
/**
* Adds an <CODE>Object</CODE> to the <CODE>List</CODE>.
*
* @param o the object to add.
* @return true if adding the object succeeded
*/
public override bool Add(Object o) {
if (o is ListItem) {
ListItem item = (ListItem) o;
Chunk chunk = new Chunk(preSymbol, symbol.Font);
chunk.Append(((char)zn).ToString());
chunk.Append(postSymbol);
item.ListSymbol = chunk;
item.SetIndentationLeft(symbolIndent, autoindent);
item.IndentationRight = 0;
list.Add(item);
return true;
} else if (o is List) {
List nested = (List) o;
nested.IndentationLeft = nested.IndentationLeft + symbolIndent;
first--;
list.Add(nested);
return true;
} else if (o is String) {
return this.Add(new ListItem((string) o));
}
return false;
}
示例4: GetChunk
public static Chunk GetChunk(Properties attributes) {
Chunk chunk = new Chunk();
chunk.Font = FontFactory.GetFont(attributes);
String value;
value = attributes[ElementTags.ITEXT];
if (value != null) {
chunk.Append(value);
}
value = attributes[ElementTags.LOCALGOTO];
if (value != null) {
chunk.SetLocalGoto(value);
}
value = attributes[ElementTags.REMOTEGOTO];
if (value != null) {
String page = attributes[ElementTags.PAGE];
if (page != null) {
chunk.SetRemoteGoto(value, int.Parse(page));
}
else {
String destination = attributes[ElementTags.DESTINATION];
if (destination != null) {
chunk.SetRemoteGoto(value, destination);
}
}
}
value = attributes[ElementTags.LOCALDESTINATION];
if (value != null) {
chunk.SetLocalDestination(value);
}
value = attributes[ElementTags.SUBSUPSCRIPT];
if (value != null) {
chunk.SetTextRise(float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo));
}
value = attributes[Markup.CSS_KEY_VERTICALALIGN];
if (value != null && value.EndsWith("%")) {
float p = float.Parse(value.Substring(0, value.Length - 1), System.Globalization.NumberFormatInfo.InvariantInfo) / 100f;
chunk.SetTextRise(p * chunk.Font.Size);
}
value = attributes[ElementTags.GENERICTAG];
if (value != null) {
chunk.SetGenericTag(value);
}
value = attributes[ElementTags.BACKGROUNDCOLOR];
if (value != null) {
chunk.SetBackground(Markup.DecodeColor(value));
}
return chunk;
}
示例5: Add
/// <summary>
/// Adds an Object to the List.
/// </summary>
/// <param name="o">the object to add</param>
/// <returns>true is successful</returns>
public virtual bool Add(IElement o)
{
if (o is ListItem) {
ListItem item = (ListItem) o;
if (numbered || lettered) {
Chunk chunk = new Chunk(preSymbol, symbol.Font);
chunk.Attributes = symbol.Attributes;
int index = first + list.Count;
if (lettered)
chunk.Append(RomanAlphabetFactory.GetString(index, lowercase));
else
chunk.Append(index.ToString());
chunk.Append(postSymbol);
item.ListSymbol = chunk;
}
else {
item.ListSymbol = symbol;
}
item.SetIndentationLeft(symbolIndent, autoindent);
item.IndentationRight = 0;
list.Add(item);
return true;
}
else if (o is List) {
List nested = (List) o;
nested.IndentationLeft = nested.IndentationLeft + symbolIndent;
first--;
list.Add(nested);
return true;
}
return false;
}
示例6: Add
/**
* Adds an <CODE>Object</CODE> to the <CODE>List</CODE>.
*
* @param o the object to add.
* @return true if adding the object succeeded
*/
public override bool Add(Object o)
{
if (o is ListItem) {
ListItem item = (ListItem) o;
Chunk chunk = new Chunk(preSymbol, symbol.Font);
chunk.Append(RomanNumberFactory.GetString(first + list.Count, lowercase));
chunk.Append(postSymbol);
item.ListSymbol = chunk;
item.SetIndentationLeft(symbolIndent, autoindent);
item.IndentationRight = 0;
list.Add(item);
return true;
} else if (o is List) {
List nested = (List) o;
nested.IndentationLeft = nested.IndentationLeft + symbolIndent;
first--;
list.Add(nested);
return true;
} else if (o is string) {
return this.Add(new ListItem((string) o));
}
return false;
}
示例7: Add
/**
* Adds an <CODE>Object</CODE> to the <CODE>List</CODE>.
*
* @param o the object to add.
* @return true if adding the object succeeded
*/
public override bool Add(IElement o) {
if (o is ListItem) {
ListItem item = (ListItem) o;
Chunk chunk = new Chunk(preSymbol, symbol.Font);
chunk.Attributes = symbol.Attributes;
chunk.Append(GreekAlphabetFactory.GetString(first + list.Count, lowercase));
chunk.Append(postSymbol);
item.ListSymbol = chunk;
item.SetIndentationLeft(symbolIndent, autoindent);
item.IndentationRight = 0;
list.Add(item);
return true;
} else if (o is List) {
List nested = (List) o;
nested.IndentationLeft = nested.IndentationLeft + symbolIndent;
first--;
list.Add(nested);
return true;
}
return false;
}
示例8: generarPdf
public static string generarPdf(Hashtable htFacturaxion, HttpContext hc)
{
string pathPdf = htFacturaxion["rutaDocumentoPdf"].ToString();
FileStream fs = new FileStream(pathPdf, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);
try
{
StringBuilder sbConfigFact = new StringBuilder();
StringBuilder sbConfigFactParms = new StringBuilder();
_ci.NumberFormat.CurrencyDecimalDigits = 2;
DAL dal = new DAL();
ElectronicDocument electronicDocument = (ElectronicDocument)htFacturaxion["electronicDocument"];
Data objTimbre = (Data)htFacturaxion["objTimbre"];
bool timbrar = Convert.ToBoolean(htFacturaxion["timbrar"]);
//string pathPdf = htFacturaxion["rutaDocumentoPdf"].ToString();
// Obtenemos el logo y plantilla
StringBuilder sbLogo = new StringBuilder();
sbLogo.
Append("SELECT S.rutaLogo, P.rutaEncabezado, P.rutaFooter ").
Append("FROM sucursales S ").
Append("LEFT OUTER JOIN tipoPlantillas P ON S.idTipoPlantilla = P.idTipoPlantilla AND P.ST = 1 ").
Append("WHERE idSucursal = @0 AND S.ST = 1");
DataTable dtLogo = dal.QueryDT("DS_FE", sbLogo.ToString(), "F:I:" + htFacturaxion["idSucursalEmisor"], hc);
string rutaLogo = dtLogo.Rows[0]["rutaLogo"].ToString();
string rutaHeader = dtLogo.Rows[0]["rutaEncabezado"].ToString();
string rutaFooter = dtLogo.Rows[0]["rutaFooter"].ToString();
//Obtenemos Rol de la empresa
StringBuilder sbRol = new StringBuilder();
sbRol.
Append("DECLARE @iduser INT; ").
Append("SELECT DISTINCT @iduser = UxR.idUser FROM sucursales S ").
Append("LEFT OUTER JOIN sucursalesXUsuario SxU ON S.idSucursal = SxU.idSucursal LEFT OUTER JOIN r3TakeCore.dbo.SYS_UserXRol UxR ON UxR.idUser = SxU.idUser ").
Append("WHERE idEmpresa = @0 AND UxR.idRol IN(22,15) AND S.ST = 1 AND SxU.ST = 1; ").
Append("SELECT UxR.idRol FROM r3TakeCore.dbo.SYS_UserXRol UxR WHERE idUser = @idUser"); //Rol 15 > MIT ; 22 > Facturizate
int idRol = dal.ExecuteScalar("DS_FE", sbRol.ToString(), "F:S:" + htFacturaxion["idEmisor"], hc);
sbConfigFactParms.
Append("F:I:").Append(Convert.ToInt64(htFacturaxion["idSucursalEmisor"])).
Append(";").
Append("F:I:").Append(Convert.ToInt32(htFacturaxion["tipoComprobante"])).
Append(";").
Append("F:S:").Append(electronicDocument.Data.Total.Value).
Append(";").
Append("F:I:").Append(Convert.ToInt32(htFacturaxion["idMoneda"])).
Append(";").
Append("F:S:").Append(rutaLogo).
Append(";").
Append("F:S:").Append(rutaHeader).
Append(";").
Append("F:S:").Append(rutaFooter).
Append(";").
Append("F:I:").Append(Convert.ToInt64(htFacturaxion["idEmisor"]));
if (idRol == 15)
{
if (rutaHeader.Length > 0)
{
sbConfigFact.
Append("SELECT @5 AS rutaTemplateHeader, @6 AS rutaTemplateFooter, @4 AS rutaLogo, objDesc, posX, posY, fontSize, dbo.convertNumToTextFunction( @2, @3) AS cantidadLetra, ").
Append("logoPosX, logoPosY, headerPosX, headerPosY, footerPosX, footerPosY, conceptosColWidth, desgloseColWidth ").
Append("FROM configuracionFacturas CF ").
Append("LEFT OUTER JOIN sucursales S ON S.idSucursal = @0 ").
Append("LEFT OUTER JOIN configuracionFactDet CFD ON CF.idConFact = CFD.idConFact ").
Append("WHERE CF.ST = 1 AND CF.idEmpresa = -1 AND CF.idTipoComp = @1 AND idCFDProcedencia = 1 AND objDesc NOT LIKE 'nuevoLbl%' ");
}
else
{
sbConfigFact.
Append("SELECT rutaTemplateHeader, rutaTemplateFooter, @4 AS rutaLogo, objDesc, posX, posY, fontSize, dbo.convertNumToTextFunction( @2, @3) AS cantidadLetra, ").
Append("logoPosX, logoPosY, headerPosX, headerPosY, footerPosX, footerPosY, conceptosColWidth, desgloseColWidth ").
Append("FROM configuracionFacturas CF ").
Append("LEFT OUTER JOIN sucursales S ON S.idSucursal = @0 ").
Append("LEFT OUTER JOIN configuracionFactDet CFD ON CF.idConFact = CFD.idConFact ").
Append("WHERE CF.ST = 1 AND CF.idEmpresa = -1 AND CF.idTipoComp = @1 AND idCFDProcedencia = 1 AND objDesc NOT LIKE 'nuevoLbl%' ");
}
}
else
{
sbConfigFact.
Append("DECLARE @idEmpresa AS INT;").
Append("IF EXISTS (SELECT * FROM configuracionFacturas WHERE idEmpresa = @7) ").
Append("SET @idEmpresa = @7; ").
Append("ELSE ").
Append("SET @idEmpresa = 0; ").
Append("SELECT rutaTemplateHeader, rutaTemplateFooter, S.rutaLogo, objDesc, posX, posY, fontSize, dbo.convertNumToTextFunction( @2, @3) AS cantidadLetra, ").
Append("logoPosX, logoPosY, headerPosX, headerPosY, footerPosX, footerPosY, conceptosColWidth, desgloseColWidth, S.nombreSucursal ").
Append("FROM configuracionFacturas CF ").
Append("LEFT OUTER JOIN sucursales S ON S.idSucursal = @0 ").
Append("LEFT OUTER JOIN configuracionFactDet CFD ON CF.idConFact = CFD.idConFact ").
Append("WHERE CF.ST = 1 AND CF.idEmpresa = @idEmpresa AND CF.idTipoComp = @1 AND idCFDProcedencia = 1 AND objDesc NOT LIKE 'nuevoLbl%' ");
}
//.........这里部分代码省略.........
示例9: CreateDirectorParagraph
// ---------------------------------------------------------------------------
/**
* Creates a Phrase with the name and given name of a director
* using different fonts.
* @param r the DbDataReader containing director records.
*/
public Paragraph CreateDirectorParagraph(PdfWriter writer, DbDataReader r)
{
string n = r["name"].ToString();
Chunk name = new Chunk(n);
name.SetAction(PdfAction.JavaScript(
string.Format("findDirector('{0}');", n),
writer
));
name.Append(", ");
name.Append(r["given_name"].ToString());
return new Paragraph(name);
}
示例10: HandleCloseGroup
/* (non-Javadoc)
* @see com.lowagie.text.rtf.direct.RtfDestination#handleGroupEnd()
*/
public override bool HandleCloseGroup()
{
this.OnCloseGroup(); // event handler
if (this.rtfParser.IsImport()) {
if (this.buffer.Length>0) {
WriteBuffer();
}
WriteText("}");
}
if (this.rtfParser.IsConvert()) {
if (this.buffer.Length > 0 && this.iTextParagraph == null) {
this.iTextParagraph = new Paragraph();
}
if (this.buffer.Length > 0 ) {
Chunk chunk = new Chunk();
chunk.Append(this.buffer.ToString());
this.iTextParagraph.Add(chunk);
}
if (this.iTextParagraph != null) {
AddParagraphToDocument();
}
}
return true;
}
示例11: BeforePropertyChange
/* (non-Javadoc)
* @see com.lowagie.text.rtf.parser.properties.RtfPropertyListener#beforeChange(java.lang.String)
*/
public void BeforePropertyChange(String propertyName)
{
// do we have any text to do anything with?
// if not, then just return without action.
if (this.buffer.Length == 0) return;
if (propertyName.StartsWith(RtfProperty.CHARACTER)) {
// this is a character change,
// add a new chunck to the current paragraph using current character settings.
Chunk chunk = new Chunk();
chunk.Append(this.buffer.ToString());
this.buffer = new StringBuilder(255);
Hashtable charProperties = this.rtfParser.GetState().properties.GetProperties(RtfProperty.CHARACTER);
String defFont = (String)charProperties[RtfProperty.CHARACTER_FONT];
if (defFont == null) defFont = "0";
RtfDestinationFontTable fontTable = (RtfDestinationFontTable)this.rtfParser.GetDestination("fonttbl");
Font currFont = fontTable.GetFont(defFont);
int fs = Font.NORMAL;
if (charProperties.ContainsKey(RtfProperty.CHARACTER_BOLD)) fs |= Font.BOLD;
if (charProperties.ContainsKey(RtfProperty.CHARACTER_ITALIC)) fs |= Font.ITALIC;
if (charProperties.ContainsKey(RtfProperty.CHARACTER_UNDERLINE)) fs |= Font.UNDERLINE;
Font useFont = FontFactory.GetFont(currFont.Familyname, 12, fs, new Color(0,0,0));
chunk.Font = useFont;
if (iTextParagraph == null) this.iTextParagraph = new Paragraph();
this.iTextParagraph.Add(chunk);
} else {
if (propertyName.StartsWith(RtfProperty.PARAGRAPH)) {
// this is a paragraph change. what do we do?
} else {
if (propertyName.StartsWith(RtfProperty.SECTION)) {
} else {
if (propertyName.StartsWith(RtfProperty.DOCUMENT)) {
}
}
}
}
}