本文整理汇总了C#中iTextSharp.text.Document.AddAuthor方法的典型用法代码示例。如果您正苦于以下问题:C# Document.AddAuthor方法的具体用法?C# Document.AddAuthor怎么用?C# Document.AddAuthor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp.text.Document
的用法示例。
在下文中一共展示了Document.AddAuthor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnCreateReport_Click
private void btnCreateReport_Click(object sender, EventArgs e)
{
// _______________________________________________________1_______________________________________________________
// Setting pagetype, margins and encryption
iTextSharp.text.Rectangle pageType = iTextSharp.text.PageSize.A4;
float marginLeft = 72;
float marginRight = 36;
float marginTop = 60;
float marginBottom = 50;
String reportName = "Test.pdf";
Document report = new Document(pageType, marginLeft, marginRight, marginTop, marginBottom);
PdfWriter writer = PdfWriter.GetInstance(report, new FileStream(reportName, FileMode.Create));
//writer.SetEncryption(PdfWriter.STRENGTH40BITS, "Good", "Bad", PdfWriter.ALLOW_COPY);
report.Open();
// _______________________________________________________2_______________________________________________________
// Setting Document properties(Meta data)
// 1. Title
// 2. Subject
// 3. Keywords
// 4. Creator
// 5. Author
// 6. Header
report.AddTitle("Employee Details Report");
report.AddSubject("This file is generated for administrative use only");
report.AddKeywords("Civil Security Department, Employee Management System, Version 1.0.0, Report Generator");
report.AddCreator("Ozious Technologies");
report.AddAuthor("Eranga Heshan");
report.AddHeader("Owner", "Civil Security Department");
// _______________________________________________________3_______________________________________________________
// Setup the font factory
/*
int totalFonts = FontFactory.RegisterDirectory("C:\\WINDOWS\\Fonts");
StringBuilder sb = new StringBuilder();
foreach (string fontname in FontFactory.RegisteredFonts) { sb.Append(fontname + "\n"); }
report.Add(new Paragraph("All Fonts:\n" + sb.ToString()));
*/
iTextSharp.text.Font fontHeader_1 = FontFactory.GetFont("Calibri", 30, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(0, 0, 0));
iTextSharp.text.Font fontHeader_2 = FontFactory.GetFont("Calibri", 15, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(125, 125, 125));
// _______________________________________________________x_______________________________________________________
// Create header
PdfContentByte cb = writer.DirectContent;
cb.MoveTo(marginLeft, marginTop);
cb.LineTo(500, marginTop);
cb.Stroke();
Paragraph paraHeader_1 = new Paragraph("Civil Security Department", fontHeader_1);
paraHeader_1.Alignment = Element.ALIGN_CENTER;
paraHeader_1.SpacingAfter = 0f;
report.Add(paraHeader_1);
Paragraph paraHeader_2 = new Paragraph("Employee Detailed Report", fontHeader_2);
paraHeader_2.Alignment = Element.ALIGN_CENTER;
paraHeader_2.SpacingAfter = 10f;
report.Add(paraHeader_2);
// _______________________________________________________x_______________________________________________________
// Adding employee image
iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(imgEmployee.ImageLocation);
img.ScaleToFit(100f, 100f);
img.Border = iTextSharp.text.Rectangle.BOX;
img.BorderColor = iTextSharp.text.BaseColor.BLACK;
img.BorderWidth = 5f;
img.Alignment = iTextSharp.text.Image.TEXTWRAP | iTextSharp.text.Image.ALIGN_RIGHT | iTextSharp.text.Image.ALIGN_TOP;
img.IndentationLeft = 50f;
img.SpacingAfter = 20f;
img.SpacingBefore = 20f;
report.Add(img);
Paragraph para1 = new Paragraph("Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... Testing... ");
para1.Alignment = Element.ALIGN_JUSTIFIED;
report.Add(para1);
report.Close();
this.Close();
}
示例2: GetOrCreatePDF
/// <summary>
/// 读取或创建Pdf文档并打开写入文件流
/// </summary>
/// <param name="fileName"></param>
/// <param name="folderPath"></param>
public Document GetOrCreatePDF(string fileName, string folderPath)
{
string filePath = folderPath + fileName;
FileStream fs = null;
if (!File.Exists(filePath))
{
fs = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.None);
}
else
{
fs = new FileStream(filePath, FileMode.Append, FileAccess.Write, FileShare.None);
}
//获取A4纸尺寸
Rectangle rec = new Rectangle(PageSize.A4);
Document doc = new Document(rec);
//创建一个 iTextSharp.text.pdf.PdfWriter 对象: 它有助于把Document书写到特定的FileStream:
PdfWriter writer = PdfWriter.GetInstance(doc, fs);
doc.AddTitle(fileName.Remove(fileName.LastIndexOf('.')));
doc.AddSubject(fileName.Remove(fileName.LastIndexOf('.')));
doc.AddKeywords("Metadata, iTextSharp 5.4.4, Chapter 1, Tutorial");
doc.AddCreator("MCS");
doc.AddAuthor("Chingy");
doc.AddHeader("Nothing", "No Header");
//打开 Document:
doc.Open();
////关闭 Document:
//doc.Close();
return doc;
}
示例3: Form1
// From <ClickButt> -> PdfConnector PdfCreatora <- PdfCreator(naemBank,Bodytext)
// Form <Image> <- PdfConnector -- tworzyć pdf |
public Form1()
{
while (!fileBanksLists.EndOfStream)
{
InitializeComponent();
using (FileStream file = new FileStream(String.Format(path, nameBank), FileMode.Create))
{
Document document = new Document(PageSize.A7);
PdfWriter writer = PdfWriter.GetInstance(document, file);
/// Create metadate pdf file
document.AddAuthor(nameBank);
document.AddLanguage("pl");
document.AddSubject("Payment transaction");
document.AddTitle("Transaction");
document.AddKeywords("OutcomingNumber :" + OutcomingNumber);
document.AddKeywords("IncomingNumber :" + IncomingNumber);
/// Create text in pdf file
document.Open();
document.Add(new Paragraph(_przelew + "\n"));
document.Add(new Paragraph(String.Format("Bank {0}: zaprasza\n", nameBank)));
document.Add(new Paragraph(DateTime.Now.ToString()));
document.Close();
writer.Close();
file.Close();
}
}
}
示例4: TryCreatePdf
public bool TryCreatePdf(string nameBank)
{
try
{
using (FileStream file = new FileStream(String.Format(path,nameBank), FileMode.Create))
{
Document document = new Document(PageSize.A7);
PdfWriter writer = PdfWriter.GetInstance(document, file);
/// Create metadate pdf file
document.AddAuthor("");
document.AddLanguage("pl");
document.AddSubject("Payment transaction");
document.AddTitle("Transaction");
/// Create text in pdf file
document.Open();
document.Add(new Paragraph(_przelew+"\n"));
document.Add(new Paragraph(String.Format("Bank {0}: zaprasza\n",nameBank)));
document.Add(new Paragraph(DateTime.Now.ToString()));
document.Close();
writer.Close();
file.Close();
return true;
}
}
catch (SystemException ex)
{
return false;
}
}
示例5: GeneratePdfSingleDataType
public static void GeneratePdfSingleDataType(string filePath, string title, string content)
{
try
{
Logger.LogI("GeneratePDF -> " + filePath);
var doc = new Document(PageSize.A3, 36, 72, 72, 144);
using (var fs = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
{
PdfWriter.GetInstance(doc, fs);
doc.Open();
doc.AddTitle(title);
doc.AddAuthor(Environment.MachineName);
doc.Add(
new Paragraph("Title : " + title + Environment.NewLine + "ServerName : " +
Environment.MachineName +
Environment.NewLine + "Author : " + Environment.UserName));
doc.NewPage();
doc.Add(new Paragraph(content));
doc.Close();
}
}
catch (Exception ex)
{
Logger.LogE(ex.Source + " -> " + ex.Message + "\n" + ex.StackTrace);
}
}
示例6: CreatePdf
public void CreatePdf(Project project, Stream writeStream)
{
var document = new Document();
var writer = PdfWriter.GetInstance(document, writeStream);
// landscape
document.SetPageSize(PageSize.A4.Rotate());
document.SetMargins(36f, 36f, 36f, 36f); // 0.5 inch margins
// metadata
document.AddCreator("EstimatorX.com");
document.AddKeywords("estimation");
document.AddAuthor(project.Creator);
document.AddSubject(project.Name);
document.AddTitle(project.Name);
document.Open();
AddName(project, document);
AddDescription(project, document);
AddAssumptions(project, document);
AddFactors(project, document);
AddTasks(project, document);
AddSummary(project, document);
writer.Flush();
document.Close();
}
示例7: WriteDocument
protected override void WriteDocument(object sender, DoWorkEventArgs e)
{
BackgroundWorker worker = sender as BackgroundWorker;
if (File.Exists(FilePath))
throw new Pdf2KTException("File already exists.");
Document document = null;
PdfWriter writer = null;
while(Converter.MoveNext())
{
if (worker.CancellationPending == true)
{
e.Cancel = true;
break;
}
BitmapEncoder encoder = BitmapProcessor.GetBitmapEncoder();
BitmapSource processed = BitmapProcessor.Convert(Converter.Current);
if (document == null)
{
document = new Document(new Rectangle(processed.PixelWidth, processed.PixelHeight));
writer = PdfWriter.GetInstance(document, new FileStream(FilePath, FileMode.Create));
document.Open();
document.AddTitle(Converter.Document.Title);
document.AddAuthor(Converter.Document.Author);
document.AddCreationDate();
document.AddCreator("Pdf2KT");
}
document.NewPage();
using (MemoryStream ms = new MemoryStream())
{
encoder.Frames.Add(BitmapFrame.Create(processed));
encoder.Save(ms);
ms.Position = 0;
Image pdfpage = Image.GetInstance(ms);
pdfpage.SetAbsolutePosition(0, 0);
document.Add(pdfpage);
}
worker.ReportProgress((int)((Converter.CurrentProcessedPageNumber * 1f) / Converter.PageCount * 100));
}
document.Close();
}
示例8: PdfGraphics
public PdfGraphics(Stream stream, int width, int height)
{
originalWidth = currentWidth = width;
originalHeight = currentHeight = height;
document = new Document(new Rectangle(width, height), 50, 50, 50, 50);
document.AddAuthor("");
document.AddSubject("");
try{
writer = PdfWriter.GetInstance(document, stream);
document.Open();
content = writer.DirectContent;
template = topTemplate = content.CreateTemplate(width, height);
content.AddTemplate(template, 0, 0);
} catch (DocumentException de){
throw new IOException(de.Message);
}
}
示例9: CreateDocument
public static void CreateDocument(Stream stream, Action<Document> action)
{
using (var document = new Document(PageSize.A4))
{
var writer = PdfWriter.GetInstance(document, stream);
document.Open();
document.AddAuthor(Author);
document.AddCreator(DocumentCreator);
document.AddKeywords(DocumentKeywords);
document.AddSubject(DocumentSubject);
document.AddTitle(DocumentTitle);
action.Invoke(document);
document.Close();
}
}
示例10: PdfGraphics
internal PdfGraphics(string filename, int width, int height)
{
originalWidth = currentWidth = width;
originalHeight = currentHeight = height;
document = new Document(new iTextSharp.text.Rectangle(width, height), 50, 50, 50, 50);
document.AddAuthor("");
document.AddSubject("");
try{
writer = PdfWriter.GetInstance(document, new FileStream(filename, FileMode.Create));
document.Open();
content = writer.DirectContent;
template = topTemplate = content.CreateTemplate(width, height);
content.AddTemplate(template, 0, 0);
} catch (DocumentException de){
throw new IOException(de.Message);
}
}
示例11: CreatePdf
// ---------------------------------------------------------------------------
/**
* Creates a PDF document.
*/
public byte[] CreatePdf() {
using (MemoryStream ms = new MemoryStream()) {
// step 1
using (Document document = new Document()) {
// step 2
PdfWriter.GetInstance(document, ms);
// step 3
document.AddTitle("Hello World example");
document.AddAuthor("Bruno Lowagie");
document.AddSubject("This example shows how to add metadata");
document.AddKeywords("Metadata, iText, PDF");
document.AddCreator("My program using iText");
document.Open();
// step 4
document.Add(new Paragraph("Hello World"));
}
return ms.ToArray();
}
}
示例12: GeneratePDF
public static MemoryStream GeneratePDF(Teacher teacher, SchoolClass schoolClass, string schoolYear)
{
Document document = new Document();
MemoryStream stream = new MemoryStream();
PdfWriter writer = PdfWriter.GetInstance(document, stream);
writer.CloseStream = false;
document.Open();
document.AddCreationDate();
document.AddAuthor("VaKEGrade");
document.AddTitle("Certificate");
foreach (Pupil pupil in teacher.PrimaryClasses.First().Pupils.OrderBy(x => x.LastName).ToList())
{
CertificateGenerator.GenerateCertificate(pupil, schoolClass, schoolYear, ref document);
}
document.Close();
stream.Seek(0, SeekOrigin.Begin);
return stream;
}
示例13: Initialize
public override void Initialize()
{
// step 1 : creation of document object
Rectangle rect = new Rectangle((float)bbox.Width * 1.1f, (float)bbox.Height * 1.1f);
rect.BackgroundColor = BaseColor.WHITE;
_pdfDocument = new iTextSharp.text.Document(rect);
// step 2:
// we create a writer that listens to the document
// and directs a PDF-stream to a file
PdfWriter writer = PdfWriter.GetInstance(_pdfDocument, _stream);
// step 3: we open the document
_pdfDocument.Open();
// step 4: we add content to the document
_pdfDocument.AddCreationDate();
_pdfDocument.AddAuthor(author);
_pdfDocument.AddTitle(title);
_cb = writer.DirectContent;
// initialize cotation
PicCotation._globalCotationProperties._arrowLength = bbox.Height / 50.0;
}
示例14: LibroAtrasos
public LibroAtrasos(AufenPortalReportesDataContext db, EMPRESA empresa, vw_Ubicacione departamento, DateTime FechaDesde, DateTime FechaHasta, string path, string rut)
{
//Nombre del archivo y ubiación en el árbol de carpetas
NombreArchivo = String.Format("{0}/{1}/LibroAtrasos.pdf", empresa.Descripcion, departamento.Descripcion);
// Vamos a buscar los datos que nos permitirtán armar elreporte
IEnumerable<sp_LibroAsistenciaResult> resultadoLibroAtrasos =
db.sp_LibroAsistencia(
FechaDesde.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture),
FechaHasta.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture),
int.Parse(empresa.Codigo).ToString(),
departamento.Codigo,
rut).ToList();
IEnumerable<LibroAsistenciaDTO> libroAtrasos = Mapper.Map<IEnumerable<sp_LibroAsistenciaResult>,
IEnumerable<LibroAsistenciaDTO>>(resultadoLibroAtrasos)
.Where(x =>x.Entrada.HasValue && x.Salida.HasValue && x.SalidaTeorica.HasValue && x.EntradaTeorica.HasValue &&
x.Entrada > x.EntradaTeorica);
// Comenzaremos a crear el reporte
if (libroAtrasos.Any())
{
Configuracion();
Document doc = new Document(iTextSharp.text.PageSize.LETTER, 10, 10, 50, 35);
using (var ms = new MemoryStream())
{
PdfWriter pdfWriter = PdfWriter.GetInstance(doc, ms);
pdfWriter.PageEvent = new Header(empresa, path);
doc.Open();
foreach (var reporte in libroAtrasos.GroupBy(x => new { x.Rut, x.IdDepartamento, x.IdEmpresa }))
{
var empleado = db.vw_Empleados.FirstOrDefault(x => x.IdEmpresa == empresa.Codigo &&
x.IdUbicacion == reporte.Key.IdDepartamento &&
x.Codigo == reporte.Key.Rut);
if (empleado == null)
{
empleado = new vw_Empleado();
}
doc.AddAuthor("Aufen");
doc.AddCreationDate();
doc.AddCreator("Aufen");
doc.AddTitle("Libro de Atrasos");
// Texto
Paragraph parrafo = new Paragraph();
parrafo.Add(new Paragraph(
String.Format("Departamento: {1}, Fecha de Reporte: {0}",
DateTime.Now.ToShortDateString(),
departamento.SucursalPlanta), Normal) { Alignment = Element.ALIGN_CENTER });
parrafo.Add(new Paragraph("Informe de Atrasos por Área", Titulo) { Alignment = Element.ALIGN_CENTER });
doc.Add(parrafo);
doc.Add(new Phrase());
doc.Add(new Phrase());
PdfPTable informacionPersonal = new PdfPTable(new float[] { 1,5});
informacionPersonal.AddCell(new PdfPCell(new Phrase("Rut:", Normal)));
informacionPersonal.AddCell(new PdfPCell(new Phrase(empleado.RutAufen, NormalNegrita)));
informacionPersonal.AddCell(new PdfPCell(new Phrase("Nombre:", Normal)));
informacionPersonal.AddCell(new PdfPCell(new Phrase(empleado.NombreCompleto, NormalNegrita)));
informacionPersonal.AddCell(new PdfPCell(new Phrase("Centro de Costos:", Normal)));
informacionPersonal.AddCell(new PdfPCell(new Phrase(String.Empty, NormalNegrita)));
doc.Add(new Phrase());
doc.Add(informacionPersonal);
// tabla
PdfPTable tabla = new PdfPTable(new float[] {2, 2, 2, 2, 2, 2, 2, 4 });
// Primera lìnea cabecera
tabla.AddCell(new PdfPCell(new Phrase("Fecha", Chico)) { Rowspan = 2 });
//tabla.AddCell(new PdfPCell(new Phrase("Empleado", Chico)) { Colspan = 3 });
tabla.AddCell(new PdfPCell(new Phrase("Horario", Chico)) { Colspan = 2 });
tabla.AddCell(new PdfPCell(new Phrase("Marcas", Chico)) { Colspan = 2 });
tabla.AddCell(new PdfPCell(new Phrase("Horas Trabajadas", Chico)) { Colspan = 2 });
tabla.AddCell(new PdfPCell(new Phrase("Autorizaciones", Chico)));
// Segunda lìnea cabecera
//tabla.AddCell(new PdfPCell(new Phrase("Rut", Chico)));
//tabla.AddCell(new PdfPCell(new Phrase("Apellidos", Chico)));
//tabla.AddCell(new PdfPCell(new Phrase("Nombres", Chico)));
tabla.AddCell(new PdfPCell(new Phrase("Ing.", Chico)));
tabla.AddCell(new PdfPCell(new Phrase("Sal.", Chico)));
tabla.AddCell(new PdfPCell(new Phrase("Ing.", Chico)));
tabla.AddCell(new PdfPCell(new Phrase("Sal.", Chico)));
tabla.AddCell(new PdfPCell(new Phrase("Atrasos", Chico)));
tabla.AddCell(new PdfPCell(new Phrase("H.T.N.", Chico)));
tabla.AddCell(new PdfPCell(new Phrase("Permisos", Chico)));
foreach (var atraso in reporte)
{
TimeSpan tiempoAtraso =
(atraso.Salida.HasValue && atraso.Entrada.HasValue ? atraso.Salida.Value.Subtract(atraso.Entrada.Value) : new TimeSpan(0)) -
(atraso.SalidaTeorica.HasValue && atraso.EntradaTeorica.HasValue ? atraso.SalidaTeorica.Value.Subtract(atraso.EntradaTeorica.Value) : new TimeSpan(0));
TimeSpan tiempoNormal = atraso.SalidaTeorica.HasValue && atraso.EntradaTeorica.HasValue ? atraso.SalidaTeorica.Value.Subtract(atraso.EntradaTeorica.Value) : new TimeSpan(0);
tabla.AddCell(new PdfPCell(new Phrase(atraso.Fecha.Value.ToString("ddd dd/MM"), Chico)) { HorizontalAlignment = Element.ALIGN_LEFT });
//tabla.AddCell(new PdfPCell(new Phrase(atraso.Rut.ToStringConGuion(), Chico)));
//tabla.AddCell(new PdfPCell(new Phrase(atraso.Apellidos, Chico)));
//tabla.AddCell(new PdfPCell(new Phrase(atraso.Nombres, Chico)));
tabla.AddCell(new PdfPCell(new Phrase(atraso.Entrada.HasValue ? atraso.Entrada.Value.ToString("HH:mm") : String.Empty, Chico)));
tabla.AddCell(new PdfPCell(new Phrase(atraso.Salida.HasValue ? atraso.Salida.Value.ToString("HH:mm") : String.Empty, Chico)));
tabla.AddCell(new PdfPCell(new Phrase(atraso.EntradaTeorica.HasValue ? atraso.EntradaTeorica.Value.ToString("HH:mm") : String.Empty, Chico)));
tabla.AddCell(new PdfPCell(new Phrase(atraso.SalidaTeorica.HasValue ? atraso.SalidaTeorica.Value.ToString("HH:mm") : String.Empty, Chico)));
tabla.AddCell(new PdfPCell(new Phrase(atraso.printAtraso, Chico)));
tabla.AddCell(new PdfPCell(new Phrase("", Chico)));
tabla.AddCell(new PdfPCell(new Phrase(atraso.Observacion, Chico)));
}
//.........这里部分代码省略.........
示例15: GeneratePDF
protected void GeneratePDF()
{
// Refresh the summary grid else there will be nothing to generate (no postback)
this.PopulateGrid();
// Create and initialize a new document object
iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.LEGAL, 24, 24, 24, 24);
document.PageSize.Rotate();
System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
try
{
// Create an instance of the writer object
iTextSharp.text.pdf.PdfWriter writer = iTextSharp.text.pdf.PdfWriter.GetInstance(document, memoryStream);
// Add some meta information to the document
Label lblPageTitle = (Label)(this.Page.Master.FindControl("lblDefaultMasterPageTitle"));
document.AddAuthor(lblPageTitle.Text);
document.AddSubject(this.lblReportTitle.Text);
// Open the document
document.Open();
// Create a table to match our current summary grid
iTextSharp.text.Table table = null;
if (this.DateRangeType == DateRangeTypes.UserSpecified)
table = new iTextSharp.text.Table(6);
else if (this.DateRangeType == DateRangeTypes.Daily)
table = new iTextSharp.text.Table(7);
else
table = new iTextSharp.text.Table(8);
table.TableFitsPage = true;
// Apply spacing/padding/borders/column widths to the table
table.Padding = 2;
table.Spacing = 0;
table.DefaultCellBorderWidth = 1;
if (this.DateRangeType == DateRangeTypes.UserSpecified)
{
float[] headerwidths1 = { 30, 30, 30, 30, 30, 30 };
table.Widths = headerwidths1;
}
else if (this.DateRangeType == DateRangeTypes.Daily)
{
float[] headerwidths2 = { 40, 30, 30, 30, 30, 30, 30 };
table.Widths = headerwidths2;
}
else
{
float[] headerwidths3 = { 40, 30, 30, 30, 30, 30, 30, 35 };
table.Widths = headerwidths3;
}
table.Width = 100;
// Add report title spanning all columns
iTextSharp.text.Font titleFont = new iTextSharp.text.Font(Font.GetFamilyIndex("Tahoma"), 6, Font.BOLD);
titleFont.Color = new iTextSharp.text.Color(System.Drawing.Color.Firebrick);
iTextSharp.text.Cell titleCell = new iTextSharp.text.Cell();
titleCell.SetHorizontalAlignment("Left");
titleCell.SetVerticalAlignment("Top");
titleCell.BackgroundColor = new iTextSharp.text.Color(System.Drawing.Color.White);
titleCell.BorderWidth = 0;
if (this.DateRangeType == DateRangeTypes.UserSpecified)
titleCell.Colspan = 6;
else if (this.DateRangeType == DateRangeTypes.Daily)
titleCell.Colspan = 7;
else
titleCell.Colspan = 8;
titleCell.AddElement(new iTextSharp.text.Phrase(this.lblReportTitle.Text, titleFont));
table.AddCell(titleCell);
// Add table headers
for (int i = 0; i < this.grdRaveForm.Columns.Count; i++)
{
iTextSharp.text.Font headerCellFont = new iTextSharp.text.Font(Font.GetFamilyIndex("Tahoma"), 8, Font.NORMAL + Font.UNDERLINE);
headerCellFont.Color = new iTextSharp.text.Color(System.Drawing.Color.White);
iTextSharp.text.Cell headerCell = new iTextSharp.text.Cell();
headerCell.SetHorizontalAlignment("Left");
headerCell.SetVerticalAlignment("Top");
headerCell.BackgroundColor = new iTextSharp.text.Color(System.Drawing.Color.SteelBlue);
headerCell.BorderColor = new iTextSharp.text.Color(System.Drawing.Color.White);
headerCell.AddElement(new iTextSharp.text.Phrase(this.grdRaveForm.Columns[i].HeaderText, headerCellFont));
table.AddCell(headerCell);
}
table.EndHeaders();
// Add data to the table
int j = 0;
int k = 0;
string phrase = "";
//.........这里部分代码省略.........