本文整理汇总了C#中iTextSharp.text.Table.AddCell方法的典型用法代码示例。如果您正苦于以下问题:C# Table.AddCell方法的具体用法?C# Table.AddCell怎么用?C# Table.AddCell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp.text.Table
的用法示例。
在下文中一共展示了Table.AddCell方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
Page.Title = "Contact List";
MemoryStream PDFData = new MemoryStream();
// step 1: creation of a document-object
Document document = new Document();
// step 2:
// we create a writer that listens to the document
// and directs a PDF-stream to a file
PdfWriter.GetInstance(document, PDFData);
// step 3: we open the document
document.Open();
// step 4: we add a paragraph to the document
document.Add(new Paragraph(DateTime.Now.ToString()));
Contact oContact = new Contact();
DataTable dtContact = oContact.LoadAll();
int numRow = dtContact.Rows.Count;
int numCol = 5;
iTextSharp.text.Table aTable = new iTextSharp.text.Table(numCol, numRow);
aTable.AutoFillEmptyCells = true;
aTable.Padding = 1;
aTable.Spacing = 1;
Cell cell = new Cell(new Phrase("Contact List", FontFactory.GetFont(FontFactory.TIMES, 14, Font.BOLD)));
cell.Header = true;
cell.Colspan = numCol;
cell.BackgroundColor = Color.LIGHT_GRAY;
cell.HorizontalAlignment = Element.ALIGN_CENTER;
aTable.AddCell(cell);
for (int i = 0; i < dtContact.Rows.Count; i++)
{
for (int n = 1; n <= numCol; n++)
aTable.AddCell(dtContact.Rows[i][n].ToString());
}
document.Add(aTable);
// step 5: we close the document
document.Close();
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.Charset = string.Empty;
Response.Cache.SetCacheability(System.Web.HttpCacheability.Public);
Response.AddHeader("Content-Disposition",
"attachment; filename=" + Title.Replace(" ", "").Replace(":", "-") + ".pdf");
Response.OutputStream.Write(PDFData.GetBuffer(), 0, PDFData.GetBuffer().Length);
Response.OutputStream.Flush();
Response.OutputStream.Close();
Response.End();
}
示例2: write_pdf
public static void write_pdf()
{
string sFilePDF="myFile.pdf";
// step 1: creation of a document-object
Document document = new Document();
try
{
// step 2:
// we create a writer that listens to the document
// and directs a PDF-stream to a file
PdfWriter writer = PdfWriter.GetInstance(document,
new FileStream(sFilePDF, FileMode.Create));
// step 3: we open the document
document.Open();
// step 4: we create a table and add it to the document
Table aTable = new Table(2, 2); // 2 rows, 2 columns
aTable.AddCell("0.0");
aTable.AddCell("0.1");
aTable.AddCell("1.0");
aTable.AddCell("1.1");
document.Add(aTable);
}
catch (DocumentException de)
{
Console.WriteLine(de.ToString());
}
catch (IOException ioe)
{
Console.WriteLine(ioe.ToString());
}
// step 5: we close the document
document.Close();
}
示例3: Export
public static void Export(DetailsView dvGetStudent, string imageFilePath, string filename)
{
int rows = dvGetStudent.Rows.Count;
int columns = dvGetStudent.Rows[0].Cells.Count;
int pdfTableRows = rows - 1;
iTextSharp.text.Table PdfTable = new iTextSharp.text.Table(2, pdfTableRows);
//PdfTable.BorderWidth = 1;
PdfTable.Cellpadding = 0;
PdfTable.Cellspacing = 0;
iTextSharp.text.Image jpg = iTextSharp.text.Image.GetInstance(imageFilePath);
jpg.Alignment = Element.ALIGN_CENTER;
jpg.ScaleToFit(150f, 150f);
string fontUrl = System.AppDomain.CurrentDomain.BaseDirectory + "Files\\arial.ttf";
BaseFont STF_Helvetica_Russian = BaseFont.CreateFont(fontUrl, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
Font font = new Font(STF_Helvetica_Russian, Font.DEFAULTSIZE, Font.NORMAL);
for (int rowCounter = 1; rowCounter < rows; rowCounter++)
{
for (int columnCounter = 0; columnCounter < columns; columnCounter++)
{
string strValue = dvGetStudent.Rows[rowCounter].Cells[columnCounter].Text;
PdfTable.AddCell(new Paragraph(strValue, font));
}
}
Document Doc = new Document();
PdfWriter.GetInstance(Doc, HttpContext.Current.Response.OutputStream);
Doc.Open();
Doc.Add(jpg);
Doc.Add(PdfTable);
Doc.Close();
HttpContext.Current.Response.ContentType = "application/pdf";
HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" + filename + ".pdf");
HttpContext.Current.Response.End();
}
示例4: Export
public static void Export(DetailsView dvGetStudent)
{
int rows = dvGetStudent.Rows.Count;
int columns = dvGetStudent.Rows[0].Cells.Count;
int pdfTableRows = rows;
iTextSharp.text.Table PdfTable = new iTextSharp.text.Table(2, pdfTableRows);
PdfTable.BorderWidth = 1;
PdfTable.Cellpadding = 0;
PdfTable.Cellspacing = 0;
for (int rowCounter = 0; rowCounter < rows; rowCounter++)
{
for (int columnCounter = 0; columnCounter < columns; columnCounter++)
{
string strValue = dvGetStudent.Rows[rowCounter].Cells[columnCounter].Text;
PdfTable.AddCell(strValue);
}
}
Document Doc = new Document();
PdfWriter.GetInstance(Doc, HttpContext.Current.Response.OutputStream);
Doc.Open();
Doc.Add(PdfTable);
Doc.Close();
HttpContext.Current.Response.ContentType = "application/pdf";
HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=StudentDetails.pdf");
HttpContext.Current.Response.End();
}
示例5: CreateTable
/**
* Creates a Table object based on this TableAttributes object.
* @return a com.lowagie.text.Table object
* @throws BadElementException
*/
public Table CreateTable() {
if (content.Count == 0) throw new BadElementException("Trying to create a table without rows.");
SimpleCell rowx = (SimpleCell)content[0];
int columns = 0;
foreach (SimpleCell cell in rowx.Content) {
columns += cell.Colspan;
}
float[] widths = new float[columns];
float[] widthpercentages = new float[columns];
Table table = new Table(columns);
table.Alignment = alignment;
table.Spacing = cellspacing;
table.Padding = cellpadding;
table.CloneNonPositionParameters(this);
int pos;
foreach (SimpleCell row in content) {
pos = 0;
foreach (SimpleCell cell in row.Content) {
table.AddCell(cell.CreateCell(row));
if (cell.Colspan == 1) {
if (cell.Width > 0) widths[pos] = cell.Width;
if (cell.Widthpercentage > 0) widthpercentages[pos] = cell.Widthpercentage;
}
pos += cell.Colspan;
}
}
float sumWidths = 0f;
for (int i = 0; i < columns; i++) {
if (widths[i] == 0) {
sumWidths = 0;
break;
}
sumWidths += widths[i];
}
if (sumWidths > 0) {
table.Width = sumWidths;
table.Locked = true;
table.Widths = widths;
}
else {
for (int i = 0; i < columns; i++) {
if (widthpercentages[i] == 0) {
sumWidths = 0;
break;
}
sumWidths += widthpercentages[i];
}
if (sumWidths > 0) {
table.Widths = widthpercentages;
}
}
if (width > 0) {
table.Width = width;
table.Locked = true;
}
else if (widthpercentage > 0) {
table.Width = widthpercentage;
}
return table;
}
示例6: MakeReport
//
// public static SimplePersonsList GetInstance(Selection selection,
// Rectangle pageSize,
// string reportFile) {
//
// if (instance == null)
// instance = new SimplePersonsList(selection, pageSize, reportFile);
// else {
// instance.selection = selection;
// instance.reportFile = reportFile;
// }
//
// if (!this.doc.IsOpen())
// this.doc.Open();
//
// return instance;
// }
public override void MakeReport()
{
Table t = new Table(3);
t.Border = 0;
t.DefaultCellBorder = 0;
Cell cell = new Cell();
cell.HorizontalAlignment = Element.ALIGN_CENTER;
t.DefaultCell = cell; // Default cell
Font fuenteTitulo = FontFactory.GetFont(FontFactory.HELVETICA_OBLIQUE, 14, Font.UNDERLINE);
cell = new Cell();
Chunk texto = new Chunk("Apellido", fuenteTitulo);
cell.Add(texto);
t.AddCell(cell);
cell = new Cell();
texto = new Chunk("Nombre", fuenteTitulo);
cell.Add(texto);
t.AddCell(cell);
cell = new Cell();
texto = new Chunk("E-Mail", fuenteTitulo);
cell.Add(texto);
t.AddCell(cell);
Font fuenteDatos = FontFactory.GetFont(FontFactory.HELVETICA, 10);
foreach (Person p in this.selection.Persons) {
cell = new Cell();
texto = new Chunk(p.Surname, fuenteDatos);
cell.Add(texto);
t.AddCell(cell);
cell = new Cell();
texto = new Chunk(p.Name, fuenteDatos);
cell.Add(texto);
t.AddCell(cell);
cell = new Cell();
texto = new Chunk(p.EMail, fuenteDatos);
cell.Add(texto);
t.AddCell(cell);
}
this.doc.Add(t);
}
示例7: Download_Click
protected void Download_Click(object sender, EventArgs e)
{
// Check condition
if (!GridView1.Columns[GridView1.Columns.Count - 1].Visible)
{
// Create PDF Document
String Path = Server.MapPath("~\\Bangdiem\\DKHP\\DKHP_" + userName + ".pdf");
Document myDocument = new Document(PageSize.A4, 5, 5, 30, 10);
if (!File.Exists(Path))
{
PdfWriter.GetInstance(myDocument, new FileStream(Path, FileMode.CreateNew));
// Open document
myDocument.Open();
BaseFont bf = BaseFont.CreateFont(Server.MapPath(@"~\Font\TIMES.TTF"), BaseFont.IDENTITY_H, true);
iTextSharp.text.Font font = new iTextSharp.text.Font(bf, 12);
iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(Server.MapPath("~/images/UIT.png"));
image.Alignment = iTextSharp.text.Image.UNDERLYING;
image.ScaleToFit(30f, 30f);
Chunk c1 = new Chunk("TRƯỜNG ĐẠI HỌC CÔNG NGHỆ THÔNG TIN", font);
c1.SetUnderline(0.5f, -4f);
Paragraph Header = new Paragraph(15);
Header.IndentationLeft = 15;
Header.Alignment = 3;
Header.Font = font;
Header.Add(image);
Header.SpacingBefore = 5f;
Header.Add(" ĐẠI HỌC QUỐC GIA THÀNH PHỐ HỒ CHÍ MINH \n ");
Header.Add(c1);
Header.Add("\n\n\n");
myDocument.Add(Header);
// Add gridview to
iTextSharp.text.Table table = new iTextSharp.text.Table(5);
// set table style properties
table.BorderWidth = 1;
table.BorderColor = Color.DARK_GRAY;
table.Padding = 4;
table.Alignment = 1;
table.Width = 90;
// set *column* widths
float[] widths = { 0.05f, 0.23f, 0.17f, 0.45f, 0.1f };
table.Widths = widths;
string[] col = { "TT", "Mã Lớp", "Mã Môn", "Tên Môn Học", "Số TC" };
font = new iTextSharp.text.Font(bf, 13, 1);
// create the *table* header row
for (int i = 0; i < col.Length; ++i)
{
Cell cell = new Cell(new Phrase(col[i], font));
cell.Header = true;
cell.HorizontalAlignment = 1;
table.AddCell(cell);
}
table.EndHeaders();
int sum = 0;
font = new iTextSharp.text.Font(bf, 12);
int order = 0;
foreach (GridViewRow row in GridView1.Rows)
{
Cell c = new Cell(new Phrase((++order).ToString(), font));
c.HorizontalAlignment = 1;
table.AddCell(c);
c = new Cell(new Phrase(row.Cells[1].Text, font));
c.HorizontalAlignment = 1;
table.AddCell(c);
c = new Cell(new Phrase(((HiddenField)row.FindControl("SubID")).Value, font));
c.HorizontalAlignment = 1;
table.AddCell(c);
c = new Cell(new Phrase(" " + ((LinkButton)row.FindControl("SubNm")).Text, font));
table.AddCell(c);
c = new Cell(new Phrase(row.Cells[3].Text, font));
c.HorizontalAlignment = 1;
try { sum += Int16.Parse(row.Cells[3].Text); }
catch (Exception ex) { }
table.AddCell(c);
}
font = new iTextSharp.text.Font(bf, 14);
Paragraph p = new Paragraph("ĐĂNG KÍ HỌC PHẦN HK " + getTerm() + " " + getYear() + " \n", font);
p.Alignment = 1;
p.Add("MSSV : " + userName);
myDocument.Add(p);
font = new iTextSharp.text.Font(bf, 12);
//.........这里部分代码省略.........
示例8: GeneratePDF
protected void GeneratePDF()
{
// Refresh the 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 = new iTextSharp.text.Table(4);
table.TableFitsPage = true;
// Apply spacing/padding/borders/column widths to the table
table.Padding = 2;
table.Spacing = 0;
table.DefaultCellBorderWidth = 1;
float[] headerwidths = { 40, 30, 30, 35 };
table.Widths = headerwidths;
table.Width = 100;
// Add report title spanning all columns
iTextSharp.text.Font titleFont = new iTextSharp.text.Font(Font.GetFamilyIndex("Tahoma"), 4, 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;
titleCell.Colspan = 4;
titleCell.AddElement(new iTextSharp.text.Phrase(this.lblReportTitle.Text, titleFont));
table.AddCell(titleCell);
// Add table headers
for (int i = 0; i < this.grdReporting.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.grdReporting.Columns[i].HeaderText, headerCellFont));
table.AddCell(headerCell);
}
table.EndHeaders();
// Add data to the table
int j = 0;
int k = 0;
string phrase = "";
foreach (System.Data.DataRow row in this._pdfDataTable.Rows)
{
j++; // Increment the row counter
k = 0; // Reset the column counter for the new row
foreach (System.Data.DataColumn col in this._pdfDataTable.Columns)
{
k++; // Increment the column counter
iTextSharp.text.Font cellFont = new iTextSharp.text.Font(Font.GetFamilyIndex("Tahoma"), 7, Font.NORMAL);
if (j % 2 == 0)
{
cellFont.Color = new iTextSharp.text.Color(System.Drawing.Color.DarkRed);
}
else
{
cellFont.Color = new iTextSharp.text.Color(System.Drawing.Color.Black);
}
iTextSharp.text.Cell cell = new iTextSharp.text.Cell();
cell.SetHorizontalAlignment("Left");
cell.SetVerticalAlignment("Top");
cell.BorderColor = new iTextSharp.text.Color(System.Drawing.Color.White);
if (j % 2 == 0)
{
//.........这里部分代码省略.........
示例9: GenerateCoreReport
public iTextSharp.text.Table GenerateCoreReport(String RptDate)
{
iTextSharp.text.Table datatable = new iTextSharp.text.Table(10);
datatable.Padding = 4.0F;
datatable.Spacing = 0.0F;
//datatable.setBorder(Rectangle.NO_BORDER);
int[] headerwidths = { 10, 24, 12, 12, 7, 7, 7, 7, 1, 1 };
datatable.SetWidths(headerwidths);
datatable.Width = 100;
// the first cell spans 10 columns
Cell cell = new Cell(new Phrase("Daily Production Report For " + RptDate, FontFactory.GetFont(FontFactory.HELVETICA, 18, iTextSharp.text.Font.BOLD)));
cell.HorizontalAlignment = 1;
cell.Leading = 30;
cell.Colspan = 10;
cell.Border = iTextSharp.text.Rectangle.NO_BORDER;
cell.BackgroundColor = iTextSharp.text.Color.LIGHT_GRAY;
datatable.AddCell(cell);
// These cells span 2 rows
datatable.DefaultCellBorderWidth = 2;
datatable.DefaultHorizontalAlignment = 1;
datatable.DefaultRowspan = 2;
datatable.AddCell("User Id");
datatable.AddCell(new Phrase("Name", FontFactory.GetFont(FontFactory.HELVETICA, 14, iTextSharp.text.Font.BOLD)));
datatable.AddCell("Work order");
datatable.AddCell("Comments");
// This cell spans the remaining 6 columns in 1 row
datatable.DefaultRowspan = 1;
datatable.DefaultColspan = 6;
datatable.AddCell("Hours");
// These cells span 1 row and 1 column
datatable.DefaultColspan = 1;
datatable.AddCell("Fab.");
datatable.AddCell("Finish");
datatable.AddCell("Eng.");
datatable.AddCell("Misc.");
datatable.AddCell("");
datatable.AddCell("");
//Here goes the Outer Loop to get the Project Information for the Day.Get the Project Name and display Here.
whitfield_prod_reports _wproj = new whitfield_prod_reports();
DataSet _mOuter = _wproj.GetProjectReportOuter(RptDate);
DataTable dtProject = _mOuter.Tables[0];
foreach (DataRow dProjRow in dtProject.Rows)
{
String _projNumber = dProjRow["TWC_Proj_Number"] == DBNull.Value ? "" : dProjRow["TWC_Proj_Number"].ToString();
String _projName = dProjRow["ProjName"] == DBNull.Value ? "" : dProjRow["ProjName"].ToString();
String _rptNumber = dProjRow["twc_report_number"] == DBNull.Value ? "" : dProjRow["twc_report_number"].ToString();
Cell cell1 = new Cell(new Phrase(_projName + '(' + _projNumber + ')' , FontFactory.GetFont(FontFactory.HELVETICA, 12, iTextSharp.text.Font.BOLD)));
cell1.HorizontalAlignment = 1;
cell1.Leading = 30;
cell1.Colspan = 10;
cell1.Border = iTextSharp.text.Rectangle.TOP_BORDER;
cell1.BackgroundColor = iTextSharp.text.Color.LIGHT_GRAY;
datatable.AddCell(cell1);
datatable.DefaultCellBorderWidth = 1;
datatable.DefaultRowspan = 1;
//Here Goes the Inner Loop for the Employees worked on the Project.
DataSet _mInner = _wproj.GetProjectReportInner(Convert.ToInt32(_rptNumber), Convert.ToInt32(_projNumber));
DataTable dtActivity = _mInner.Tables[0];
foreach (DataRow drActivity in dtActivity.Rows)
{
datatable.DefaultHorizontalAlignment = 1;
datatable.AddCell(drActivity["loginid"] == DBNull.Value ? "" : drActivity["loginid"].ToString());
datatable.AddCell(drActivity["UName"] == DBNull.Value ? "" : drActivity["UName"].ToString());
datatable.AddCell(drActivity["Description"] == DBNull.Value ? "" : drActivity["Description"].ToString());
datatable.AddCell(drActivity["empl_comments"] == DBNull.Value ? "" : drActivity["empl_comments"].ToString());
datatable.DefaultHorizontalAlignment = 0;
datatable.AddCell(drActivity["fab_hours"] == DBNull.Value ? "0" : drActivity["fab_hours"].ToString());
datatable.AddCell(drActivity["fin_hours"] == DBNull.Value ? "0" : drActivity["fin_hours"].ToString());
datatable.AddCell(drActivity["eng_hours"] == DBNull.Value ? "0" : drActivity["eng_hours"].ToString());
datatable.AddCell(drActivity["misc_hours"] == DBNull.Value ? "0" : drActivity["misc_hours"].ToString());
_totFabHours += Convert.ToInt32(drActivity["fab_hours"] == DBNull.Value ? "0" : drActivity["fab_hours"].ToString());
_totFinHours += Convert.ToInt32(drActivity["fin_hours"] == DBNull.Value ? "0" : drActivity["fin_hours"].ToString());
_totEngHours += Convert.ToInt32(drActivity["eng_hours"] == DBNull.Value ? "0" : drActivity["eng_hours"].ToString());
_totMiscHours += Convert.ToInt32(drActivity["misc_hours"] == DBNull.Value ? "0" : drActivity["misc_hours"].ToString());
datatable.AddCell("");
datatable.AddCell("");
}
//Here goes the SubTotal Per project.. Dont Forget.
datatable.DefaultCellBorderWidth = 1;
datatable.DefaultRowspan = 1;
datatable.DefaultHorizontalAlignment = 1;
datatable.AddCell("");
datatable.AddCell("Subtotal:");
datatable.AddCell("");
datatable.AddCell("");
datatable.DefaultHorizontalAlignment = 0;
datatable.AddCell(_totFabHours.ToString());
datatable.AddCell(_totFinHours.ToString());
datatable.AddCell(_totEngHours.ToString());
datatable.AddCell(_totMiscHours.ToString());
datatable.AddCell("");
//.........这里部分代码省略.........
示例10: GeneratePDF
public void GeneratePDF(DataSet _ms)
{
String rpt_date = "";
String Daily_notes = "";
String Daily_comments = "";
String Change_order_notes = "";
DataTable dtPDFData = _ms.Tables[0];
foreach (DataRow dRow in dtPDFData.Rows)
{
rpt_date = dRow["rpt_date"] == DBNull.Value ? "" : dRow["rpt_date"].ToString();
Daily_notes = dRow["Daily_notes"] == DBNull.Value ? "" : dRow["Daily_notes"].ToString();
Daily_comments = dRow["Daily_comments"] == DBNull.Value ? "" : dRow["Daily_comments"].ToString();
Change_order_notes = dRow["Change_order_notes"] == DBNull.Value ? "" : dRow["Change_order_notes"].ToString();
}
MemoryStream m = new MemoryStream();
//Document document = new Document();
Document document = new Document(PageSize.A4.Rotate(), 50, 50, 50, 50);
try
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition","attachment;filename=DailyProjectReport.pdf");
//PdfWriter.GetInstance(document, new FileStream("HarishTesting.pdf", FileMode.Create));
PdfWriter writer = PdfWriter.GetInstance(document, m);
writer.CloseStream = false;
document.AddAuthor("Whitfield Corporation");
document.AddSubject("Daily Production REPORT");
Phrase phrase4 = new Phrase();
phrase4.Add(BuildNewCellSpanRows("Whitfield Corporation Daily Production Report for ", rpt_date));
HeaderFooter headerFooter2 = new HeaderFooter(phrase4, false);
headerFooter2.Border = 0;
HeaderFooter headerFooter1 = new HeaderFooter(new Phrase("Page: ", FontFactory.GetFont("Times-Roman", 8.0F, 0, new iTextSharp.text.Color(0, 0, 0))), true);
headerFooter1.Border = 0;
document.Footer = headerFooter1;
document.Header = headerFooter2;
document.Open();
iTextSharp.text.Table table1 = new iTextSharp.text.Table(2);
table1.Padding = 4.0F;
table1.Spacing = 0.0F;
float[] fArr2 = new float[] { 24.0F, 24.0F };
float[] fArr1 = fArr2;
table1.WidthPercentage = 100.0F;
Cell cell = new Cell(new Phrase("General Information", FontFactory.GetFont(FontFactory.HELVETICA, 18, iTextSharp.text.Font.BOLD)));
cell.HorizontalAlignment = 1;
cell.VerticalAlignment = 1;
cell.Leading = 8.0F;
cell.Colspan = 2;
cell.Border = 0;
cell.BackgroundColor = new iTextSharp.text.Color(190, 190, 190);
table1.AddCell(cell);
table1.DefaultCellBorderWidth = 1.0F;
table1.DefaultRowspan = 1;
table1.DefaultHorizontalAlignment = 0;
//table1.AddCell(BuildNewCell("Report Date:", rpt_date.Trim()));
//cell = new Cell(BuildNewCell("Daily Notes:", Daily_notes));
//cell.Colspan = 2;
//table1.AddCell(cell);
cell = new Cell(BuildNewCell("Daily Comments:", Daily_comments));
cell.Colspan = 2;
table1.AddCell(cell);
//cell = new Cell(BuildNewCell("Change Order Notes:", Change_order_notes));
//cell.Colspan = 2;
//table1.AddCell(cell);
//table1.AddCell("");
document.Add(table1);
document.Add(GenerateCoreReport(rpt_date));
}
catch (DocumentException)
{
throw;
}
document.Close();
Response.Buffer = true;
Response.Clear();
//Write pdf byes to outputstream
Response.OutputStream.Write(m.GetBuffer(), 0, m.GetBuffer().Length);
Response.OutputStream.Flush();
Response.End();
}
示例11: ObtenhaTabelaCelulaProcesso
private Table ObtenhaTabelaCelulaProcesso(IRevistaDePatente revista)
{
var tabela = new Table(1);
var corBackgroudHeader = new Color(211, 211, 211);
tabela.Widths = new Single[] { 100 };
tabela.Padding = 0;
tabela.Spacing = 0;
tabela.Width = 100;
tabela.AutoFillEmptyCells = true;
tabela.Border = 0;
tabela.EndHeaders();
var celula1 = new Cell(new Phrase("Processo " + revista.NumeroDoProcessoFormatado, _Fonte3));
celula1.DisableBorderSide(0);
celula1.BackgroundColor = corBackgroudHeader;
tabela.AddCell(celula1);
return tabela;
}
示例12: RenderProjectsReports
private void RenderProjectsReports()
{
if (this.ProjectList != null && this.ProjectList.Count > 0)
{
// float[] DetailsHeaderwidths = {"100"}; // percentage
iTextSharp.text.Table JobDetailstable = new iTextSharp.text.Table(1);
JobDetailstable.Padding = 1;
JobDetailstable.DefaultCell.BorderWidth = 1;
// JobDetailstable.Widths = DetailsHeaderwidths;
JobDetailstable.WidthPercentage = 100;
JobDetailstable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
JobDetailstable.DefaultCell.BackgroundColor = Color.LIGHT_GRAY;
Font myDetailFont = fntDetails;
JobDetailstable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
JobDetailstable.AddCell(new Phrase("Projects", fntDetails));
foreach (var x in this.ProjectList)
{
JobDetailstable.DefaultCell.BackgroundColor = Color.WHITE;
JobDetailstable.AddCell(new Phrase(x.Project_Number + " : " + x.Project_Name, fntDetails));
}
JobDetailstable.DefaultCell.BorderWidth = 0;
JobDetailstable.AddCell(new Phrase(" ", fntDetails));
JobDetailstable.AddCell(new Phrase(" ", fntDetails));
JobDetailstable.AddCell(new Phrase(" ", fntDetails));
JobDetailstable.AddCell(new Phrase(" ", fntDetails));
JobDetailstable.AddCell(new Phrase(" ", fntDetails));
JobDetailstable.AddCell(new Phrase(" ", fntDetails));
doc.Add(JobDetailstable);
}
}
示例13: formatoABCDIJKLM
public static void formatoABCDIJKLM(Document document, ElectronicDocument electronicDocument, Data objTimbre, pdfPageEventHandlerPfizer pageEventHandler, Int64 idCfdi, DataTable dtEncabezado, DataTable dtDetalle, Hashtable htCFDI, HttpContext hc)
{
try
{
DAL dal = new DAL();
#region "Construimos el Documento"
#region "Construimos el Encabezado"
Table encabezado = new Table(7);
float[] headerwidthsEncabezado = { 9, 18, 28, 28, 5, 7, 5 };
encabezado.Widths = headerwidthsEncabezado;
encabezado.WidthPercentage = 100;
encabezado.Padding = 1;
encabezado.Spacing = 1;
encabezado.BorderWidth = 0;
encabezado.DefaultCellBorder = 0;
encabezado.BorderColor = gris;
//Agregando Imagen de Logotipo
Image imgLogo = Image.GetInstance(pathIMGLOGO);
imgLogo.ScalePercent(47f);
par = new Paragraph();
par.KeepTogether = true;
par.SetLeading(1f, 1f);
par.Add(new Chunk(imgLogo, 0, 0));
par.Add(new Chunk("", f6));
cel = new Cell(par);
cel.BorderWidthTop = 0;
cel.BorderWidthLeft = 0;
cel.BorderWidthRight = 0;
cel.BorderWidthBottom = 0;
cel.Rowspan = 5;
cel.Colspan = 2;
encabezado.AddCell(cel);
par = new Paragraph();
par.KeepTogether = true;
par.SetLeading(8f, 9f);
par.Add(new Chunk(htCFDI["nombreEmisor"].ToString().ToUpper(), f6B));
par.Add(new Chunk("\nRFC " + htCFDI["rfcEmisor"].ToString().ToUpper(), f6));
par.Add(new Chunk("\n" + htCFDI["direccionEmisor1"].ToString().ToUpper(), f6));
par.Add(new Chunk("\n" + htCFDI["direccionEmisor2"].ToString().ToUpper(), f6));
par.Add(new Chunk("\n" + htCFDI["direccionEmisor3"].ToString().ToUpper(), f6));
par.Add(new Chunk("\nTel. (52) 55 5081-8500", f6));
cel = new Cell(par);
cel.BorderWidthTop = 0;
cel.BorderWidthLeft = 0;
cel.BorderWidthRight = 0;
cel.BorderWidthBottom = 0;
cel.Rowspan = 5;
encabezado.AddCell(cel);
StringBuilder expedido = new StringBuilder();
expedido.
Append("Lugar de Expedición México DF\n").
Append(htCFDI["sucursal"]).Append("\n").
Append(htCFDI["direccionExpedido1"].ToString().ToUpper()).Append("\n").
Append(htCFDI["direccionExpedido2"].ToString().ToUpper()).Append("\n").
Append(htCFDI["direccionExpedido3"].ToString().ToUpper()).Append("\n");
cel = new Cell(new Phrase(expedido.ToString(), f6));
cel.VerticalAlignment = Element.ALIGN_MIDDLE;
cel.BorderColor = gris;
cel.BorderWidthTop = 0;
cel.BorderWidthLeft = 0;
cel.BorderWidthRight = (float).5;
cel.BorderWidthBottom = 0;
cel.Rowspan = 4;
encabezado.AddCell(cel);
cel = new Cell(new Phrase(htCFDI["tipoDoc"].ToString(), titulo));
cel.VerticalAlignment = Element.ALIGN_MIDDLE;
cel.HorizontalAlignment = Element.ALIGN_CENTER;
cel.BackgroundColor = azul;
cel.BorderWidthTop = 0;
cel.BorderWidthLeft = 0;
cel.BorderWidthRight = 0;
cel.BorderWidthBottom = 0;
cel.BorderColor = gris;
cel.Colspan = 3;
encabezado.AddCell(cel);
cel = new Cell(new Phrase(htCFDI["serie"].ToString().ToUpper() + electronicDocument.Data.Folio.Value, f6B));
cel.VerticalAlignment = Element.ALIGN_MIDDLE;
cel.HorizontalAlignment = Element.ALIGN_CENTER;
cel.BorderWidthTop = 0;
cel.BorderWidthLeft = 0;
cel.BorderWidthRight = (float).5;
cel.BorderWidthBottom = (float).5;
cel.BorderColor = gris;
cel.Colspan = 3;
encabezado.AddCell(cel);
cel = new Cell(new Phrase("Día", f6B));
cel.VerticalAlignment = Element.ALIGN_MIDDLE;
cel.HorizontalAlignment = Element.ALIGN_CENTER;
cel.BorderWidthTop = 0;
cel.BorderWidthLeft = 0;
//.........这里部分代码省略.........
示例14: generarPdf
//.........这里部分代码省略.........
PdfPTable encabezado = new PdfPTable(3);
encabezado.WidthPercentage = 100;
encabezado.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin;
encabezado.SetWidths(new int[3] { 30, 10, 60 });
encabezado.DefaultCell.Border = 0;
encabezado.LockedWidth = true;
pathIMGLOGO = @"C:\Inetpub\repositorioFacturaxion\imagesFacturaEspecial\SOLIPLAS\logoSoliplas.png";
pathIMGFX = @"C:\Inetpub\repositorioFacturaxion\imagesFacturaEspecial\SOLIPLAS\cfdifx.png";
Image imgLogo = Image.GetInstance(pathIMGLOGO);
imgLogo.ScalePercent(48f);
Image imgFx = Image.GetInstance(pathIMGFX);
imgFx.ScalePercent(25f);
#region "Construimos el encabezado y Detalles del documento"
//Encabezado Folio Fiscal
Table encabezadoFolio = new Table(3);
float[] headerEncabezadoFolio = { 60, 10, 30 };
encabezadoFolio.Widths = headerEncabezadoFolio;
encabezadoFolio.WidthPercentage = 100F;
encabezadoFolio.Padding = 1;
encabezadoFolio.Spacing = 1;
encabezadoFolio.BorderWidth = 0;
encabezadoFolio.DefaultCellBorder = 0;
encabezadoFolio.BorderColor = gris;
cel = new Cell(imgFx);
cel.HorizontalAlignment = Element.ALIGN_LEFT;
cel.BorderWidthTop = 0;
cel.BorderWidthLeft = 0;
cel.BorderWidthRight = 0;
cel.BorderWidthBottom = 0;
encabezadoFolio.AddCell(cel);
cel = new Cell(new Phrase("Folio Fiscal", titulo));
cel.HorizontalAlignment = Element.ALIGN_CENTER;
cel.BorderColor = gris;
cel.BackgroundColor = azul;
encabezadoFolio.AddCell(cel);
cel = new Cell(new Phrase(htDatosCfdi["folioFiscal"].ToString().ToUpper(), f6));
cel.VerticalAlignment = Element.ALIGN_MIDDLE;
cel.HorizontalAlignment = Element.ALIGN_CENTER;
cel.BorderWidthTop = 1;
cel.BorderWidthLeft = 1;
cel.BorderWidthRight = 1;
cel.BorderWidthBottom = 1;
cel.BorderColor = azul;
encabezadoFolio.AddCell(cel);
//Encabezado Comprobante
Table encabezadoComprobante = new Table(6);
float[] headerEncabezadoComprobante = { 30,40,5,5,10,10 };
encabezadoComprobante.Widths = headerEncabezadoComprobante;
encabezadoComprobante.WidthPercentage = 100F;
encabezadoComprobante.Padding = 1;
encabezadoComprobante.Spacing = 1;
encabezadoComprobante.BorderWidth = 0;
encabezadoComprobante.DefaultCellBorder = 0;
encabezadoComprobante.BorderColor = gris;
//LOGO DELA EMPRESA
cel = new Cell(imgLogo);
cel.HorizontalAlignment = Element.ALIGN_CENTER;
cel.BorderWidthTop = 0;
示例15: GenerateXMLReport
public void GenerateXMLReport()
{
try
{
this.doc.Open();
RenderLogo();
RenderDescription();
RenderReportJobInfo();
iTextSharp.text.Table myTable = new iTextSharp.text.Table(ColList.Count);
myTable.Widths = this.Headerwidths;
myTable.WidthPercentage = 100;
//myTable.Locked = true;
//Render Table Headers~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
myTable.DefaultLayout.HorizontalAlignment = Element.ALIGN_LEFT;
myTable.DefaultCell.BorderWidth = ReportBorderWidth;
myTable.Cellpadding = 1;
myTable.DefaultCell.VerticalAlignment = Element.ALIGN_MIDDLE;
myTable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
myTable.DefaultCell.BackgroundColor = Color.LIGHT_GRAY;
myTable.DefaultCell.UseBorderPadding = true;
foreach (var x in this.ColList)
{
myTable.AddCell(new Phrase(x, fntHeading));
}
myTable.EndHeaders();
//Render Details~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Font myDetailFont = fntDetails;
foreach (var x in this.ReportRows)
{
for (int i = 0; i < ColList.Count; i++)
{
myTable.DefaultCell.BackgroundColor = Color.WHITE;
if (x.row[i].type == CellType.Number)
myTable.DefaultCell.HorizontalAlignment = Element.ALIGN_RIGHT;
else
myTable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
if (i > ColList.Count - 3)
myTable.DefaultCell.BackgroundColor = Color.LIGHT_GRAY;
else
myTable.DefaultCell.BackgroundColor = Color.WHITE;
if (i == ColList.Count - 3)
myTable.AddCell(new Phrase(x.row[i].value, footerFont));
else
myTable.AddCell(new Phrase(x.row[i].value, myDetailFont));
}
}
//Footer Totals~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
myTable.DefaultCell.HorizontalAlignment = Element.ALIGN_RIGHT;
myTable.DefaultCell.BackgroundColor = Color.WHITE;
myTable.DefaultCell.Colspan = 4;
myTable.AddCell(new Phrase("Totals", footerFont));
myTable.DefaultCell.Colspan = 1;
for (int i = 4; i < FooterList.Count; i++)
{
myTable.AddCell(new Phrase(FooterList[i], footerFont));
//if ((FooterList[i].Length > 0 && SacoList[i].Length > 0) && (decimal.Parse(FooterList[i]) > decimal.Parse(SacoList[i])))
//{
// myTable.AddCell(new Phrase(FooterList[i], ErrorFont));
//}
//else
//{
// if (SacoList[i].Trim().Length == 0)
// myTable.AddCell(new Phrase(FooterList[i], ErrorFont));
// else
// myTable.AddCell(new Phrase(FooterList[i], footerFont));
//}
}
//Render Saco Totals~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
myTable.DefaultCell.HorizontalAlignment = Element.ALIGN_RIGHT;
myTable.DefaultCell.BackgroundColor = Color.BLUE;
myTable.DefaultCell.Colspan = 4;
myTable.AddCell(new Phrase("Saco Hours", SacoFont));
myTable.DefaultCell.Colspan = 1;
for (int i = 4; i < SacoList.Count; i++)
{
myTable.AddCell(new Phrase(SacoList[i], SacoFont));
}
//Render Diff Totals~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
myTable.DefaultCell.HorizontalAlignment = Element.ALIGN_RIGHT;
myTable.DefaultCell.BackgroundColor = Color.WHITE;
//.........这里部分代码省略.........