BN089-BS开发框架MVC4版/source20131023/Zephyr.Net/Zephyr.Utils/Document/PDF/Gios/demo/demo3.txt
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Data;
using System.Collections;
using System.Drawing;
using Gios.Pdf;
namespace Pdf_Example3
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
// We use a template document format: the 8.5 x 11 letter but "as landascape"
PdfDocument myPdfDocument=new PdfDocument(PdfDocumentFormat.Letter_8_5x11_Horizontal);
// This time we crate some Font in order to call them easy way...
Font FontRegular=new Font("Times New Roman",9,FontStyle.Regular);
Font FontBold=new Font("Courier New",9,FontStyle.Bold);
// Now we create a Table of 200 lines, 6 columns and 8 points of Padding.
PdfTable myPdfTable=myPdfDocument.NewTable(FontRegular,200,6,4);
// Importing datas from the datatables... (also column names for the headers!)
myPdfTable.ImportDataTable(Table);
// Sets the format for correct date-time representation
myPdfTable.Columns[2].SetContentFormat("{0:dd/MM/yyyy}");
// Now we set our Graphic Design: Colors and Borders...
myPdfTable.HeadersRow.SetColors(Color.White,Color.Navy);
myPdfTable.SetColors(Color.Black,Color.White,Color.Gainsboro);
myPdfTable.SetBorders(Color.Black,1,BorderType.CompleteGrid);
// You can also set colors for a range of cells, in this case, a column:
myPdfTable.Columns[0].SetBackgroundColor(Color.LightCyan,Color.LightBlue);
//myPdfTable.Columns[2].SetContentFormat("{0:dd/MM/yyyy}");
// With just one method we can set the proportional width of the columns.
// It's a "percentage like" assignment, but the sum can be different from 100.
myPdfTable.SetColumnsWidth(new int[]{5,25,8,20,20,20});
// Sets a spanning of 3 columns to a range of cells.
foreach (PdfCell pc in myPdfTable.CellRange(3,3,8,3).Cells)
pc.ColSpan=3;
// Now we set some alignment... for the whole table, and then, for
// certain columns.
myPdfTable.SetContentAlignment(ContentAlignment.MiddleCenter);
myPdfTable.Columns[0].SetContentAlignment(ContentAlignment.MiddleRight);
myPdfTable.Columns[1].SetContentAlignment(ContentAlignment.MiddleLeft);
// This will load the image without placing into the document. The good thing
// is that the image will be written into the document just once even if we put it
// more times and in different sizes and places!
PdfImage LogoImage=myPdfDocument.NewImage(@"..\..\logo.jpg");
// Now the funny thing: Once we have a PdfArea, we can use it to do many many thigs...
后面还有 79 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
