本文整理汇总了C#中ModuleBuilder.AddPage方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleBuilder.AddPage方法的具体用法?C# ModuleBuilder.AddPage怎么用?C# ModuleBuilder.AddPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModuleBuilder
的用法示例。
在下文中一共展示了ModuleBuilder.AddPage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
var options = new Options();
CommandLine.ICommandLineParser cmdParser =
new CommandLine.CommandLineParser(new CommandLine.CommandLineParserSettings(System.Console.Error));
if (cmdParser.ParseArguments(args, options)) {
string connectionString = string.Format("URI=file:{0}", options.Database);
#if (NET)
var connection = new System.Data.SQLite.SQLiteConnection(connectionString);
#else
var connection = new Mono.Data.Sqlite.SqliteConnection(connectionString);
#endif
connection.Open();
var command = connection.CreateCommand();
command.CommandText =
"CREATE TABLE IF NOT EXISTS at (id INTEGER PRIMARY KEY NOT NULL,name VARCHAR,surname VARCHAR,year INTEGER,gender CHAR,time VARCHAR)";
command.ExecuteNonQuery();
var repo = new AthleteRepository(command);
switch (options.Action) {
case Action.Module: {
// 10mm d=> 28pt
// 15mm => 42pt
//float marginLeft, float marginRight, float marginTop, float marginBottom
var document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 10, 10, 36, 36);
iTextSharp.text.pdf.PdfWriter.GetInstance(document,
new System.IO.FileStream("./module.pdf", System.IO.FileMode.Create));
document.Open();
var builder = new ModuleBuilder(document, options.YearEdition, 10);
for (int page = 0; page < 10; page++) {
builder.AddPage();
}
document.Close();
break;
}
case Action.Insert: {
System.Console.WriteLine("Drop all results?[y/N]?");
string yes = System.Console.ReadLine();
if (yes == "y") {
FileHelpers.FileHelperEngine<Athlete> engine = new FileHelpers.FileHelperEngine<Athlete>();
Athlete[] athletes = engine.ReadFile(options.Input);
repo.DeleteAll();
foreach (var a in athletes) {
System.Console.WriteLine(a.Name);
repo.Insert(a);
}
}
break;
}
case Action.CreateList:
case Action.CreateResult: {
string catFileName = GetCatFileName(options);
string reportFileName = GetReportFileName(options);
var document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 10, 10, 36, 36);
iTextSharp.text.pdf.PdfWriter.GetInstance(document,
new System.IO.FileStream(reportFileName, System.IO.FileMode.Create));
document.Open();
IBuilder builder = null;
if (options.Action == Action.CreateList) {
builder = new ListBuilder(document);
} else {
builder = new PdfBuilder(document);
}
Category[] cats = GetCategories(catFileName);
foreach (Category cat in cats) {
if (log.IsDebugEnabled) log.Debug("parse" + cat.Id);
builder.BeginReport(cat.Title, options.YearEdition);
var athletes = repo.Query(string.Format (cat.Sql, options.YearEdition));
foreach (Athlete athlete in athletes) {
builder.Add(athlete);
}
builder.EndReport();
}
document.Close();
break;
}
case Action.Interactive: {
Category[] cats = GetCategories(GetCatFileName(options));
var parser = new TimeParser();
foreach (Category cat in cats) {
System.Console.WriteLine("========{0}=========", cat.Id);
var athletes = repo.Query(string.Format (cat.Sql, options.YearEdition));
foreach (Athlete athlete in athletes) {
System.Console.Write("{0:00} {1}\t{2}({3}):", athlete.Id, athlete.Surname, athlete.Name, athlete.Gender);
string time = string.Empty;
string fmt = string.Empty;
do {
time = System.Console.ReadLine();
fmt = parser.Parse(time);
if (!string.IsNullOrEmpty(fmt) ) {
System.Console.WriteLine(fmt);
repo.UpdateTime(athlete.Id, fmt);
} else {
if (time != "s") {
System.Console.WriteLine("invalid..");
//.........这里部分代码省略.........