本文整理汇总了C#中iTextSharp.text.List.Insert方法的典型用法代码示例。如果您正苦于以下问题:C# List.Insert方法的具体用法?C# List.Insert怎么用?C# List.Insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp.text.List
的用法示例。
在下文中一共展示了List.Insert方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadCustomers
void LoadCustomers()
{
CustomerService customerService = new CustomerService();
customers = customerService.GetCustomers().OrderBy(x => x.CustCode).ToList();
customers.Insert(0, new Customer() { Id = 0, CustomerName = "Tất cả", CustCode = "Tất cả"});
cbmCustomers.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
cbmCustomers.AutoCompleteSource = AutoCompleteSource.ListItems;
cbmCustomers.DataSource = customers;
cbmCustomers.DisplayMember = "CustCode";
cbmCustomers.ValueMember = "Id";
}
示例2: Invoice
public HttpResponseMessage Invoice(string date, string number, string total, string emails, string clientNumber, string matter, string description)
{
byte[] pdf = null;
using (var ms = new MemoryStream())
{
using (var doc = new Document())
{
doc.SetMargins(60, 60, 40, 40);
PdfWriter.GetInstance(doc, ms);
doc.Open();
#region Header
var table = new PdfPTable(4) { WidthPercentage = 100 };
var colSizes = new List<float> { 120f, 130f, 140f };
colSizes.Add(doc.PageSize.Width - colSizes.Sum());
table.SetWidths(colSizes.ToArray());
table.AddCell(new PdfPCell
{
Image = Image.GetInstance(HttpContext.Current.Request.MapPath("~\\App_Data\\Logo.jpg")),
BorderColorRight = BaseColor.WHITE,
Rowspan = 3
});
table.AddCell(new PdfPCell(CreatePhrase("950 E. State Hwy 114\nSuite 160\nSouthlake, TX 76092"))
{
HorizontalAlignment = Element.ALIGN_CENTER,
VerticalAlignment = Element.ALIGN_MIDDLE,
Rowspan = 3
});
table.AddCell(CreateCell("Invoice Date", Element.ALIGN_RIGHT));
table.AddCell(CreateCell(date, Element.ALIGN_CENTER));
table.AddCell(CreateCell("Invoice Number", Element.ALIGN_RIGHT));
table.AddCell(CreateCell(number, Element.ALIGN_CENTER));
table.AddCell(CreateCell("Invoice Total", Element.ALIGN_RIGHT));
table.AddCell(CreateCell(total, Element.ALIGN_CENTER));
doc.Add(table);
#endregion
#region Emails
doc.Add(CreatePhrase(" "));
table = new PdfPTable(1) { WidthPercentage = 100 };
table.AddCell(CreateCell($"Invoice for {emails}", Element.ALIGN_CENTER));
doc.Add(table);
#endregion
#region Matters
doc.Add(CreatePhrase(" "));
table = new PdfPTable(4) { WidthPercentage = 100 };
colSizes = new List<float> { 120f, 130f, 80f };
colSizes.Insert(2, doc.PageSize.Width - colSizes.Sum());
table.SetWidths(colSizes.ToArray());
var columns = new List<string> { "Client", "Matter", "Description", "Amount" };
columns.ForEach(c =>
{
var cell = new PdfPCell
{
Phrase = CreatePhrase(c, headerFont),
HorizontalAlignment = Element.ALIGN_CENTER
};
table.AddCell(cell);
});
columns = new List<string> { clientNumber, matter, description, total };
columns.ForEach(c =>
{
table.AddCell(CreateCell(c, Element.ALIGN_CENTER));
});
doc.Add(table);
#endregion
#region Footer
doc.Add(CreatePhrase("\nIf you have any questions, please contact us at [email protected]\n"));
doc.Add(CreatePhrase("\nThank you for using SyncIDS.com!"));
#endregion
}
pdf = ms.ToArray();
}
var response = new HttpResponseMessage(HttpStatusCode.OK);
response.Content = new ByteArrayContent(pdf);
response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/pdf");
return response;
}
示例3: mergeDocuments
protected static string mergeDocuments(string sourcepath, string destinationPath, int leadID, int claimID)
{
List<LeadsDocument> documents = null;
List<ClaimDocument> claimDocuments = null;
List<string> pdfs = new List<string>();
string mergedReportPath = null;
documents = LeadsUploadManager.getLeadsDocumentForExportByLeadID(leadID);
claimDocuments = ClaimDocumentManager.GetAll(claimID);
// add original document to list
pdfs.Insert(0, sourcepath);
// lead documents
if (documents != null && documents.Count > 0) {
List<string> leadPDFs = (from x in documents
where x.DocumentName.Contains(".pdf")
select string.Format("{0}/LeadsDocument/{1}/{2}/{3}", appPath, x.LeadId, x.LeadDocumentId, x.DocumentName)
).ToList();
foreach(string pdf in leadPDFs) {
pdfs.Add(pdf);
}
}
// claim documents
if (claimDocuments != null && claimDocuments.Count > 0) {
List<string> claimPDFs = (from x in claimDocuments
where x.DocumentName.Contains(".pdf")
select string.Format("{0}/ClaimDocuments/{1}/{2}/{3}", appPath, x.ClaimID, x.ClaimDocumentID, x.DocumentName)
).ToList();
foreach (string pdf in claimPDFs) {
pdfs.Add(pdf);
}
}
// mergedReportPath = Path.GetDirectoryName(sourcepath) + "\\" + Guid.NewGuid().ToString() + ".pdf";
// mergePDFFiles(mergedReportPath, pdfs.ToArray());
mergePDFFiles(destinationPath, pdfs.ToArray());
return destinationPath;
}
示例4: backgroundWorker1_DoWork
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
string pdfPathSql = string.Empty;
pathstr = User.rootpath + "\\" + drawing;
if (!Directory.Exists(pathstr))//若文件夹不存在则新建文件夹
{
Directory.CreateDirectory(pathstr); //新建文件夹
}
DataSet ds = new DataSet();
if (indicator == 0)
{
pdfPathSql = @"select t.pdfpath,t.spoolname
from sp_pdf_tab t
where t.spoolname in
(select s.spoolname
from sp_spool_tab s
where s.flag = 'Y'
and s.drawingno = '" + drawing + "' and s.projectid = '" + pid + "' ) and t.flag = 'Y' order by t.spoolname";
User.DataBaseConnect(pdfPathSql, ds);
}
if (indicator == 1)
{
pdfPathSql = @"select t.pdfpath
from sp_pdf_tab t
where t.spoolname in
(select s.spoolname
from sp_spool_tab s
where s.flag = 'Y'
and s.MODIFYDRAWINGNO = '" + drawing + "' and s.projectid = '" + pid + "' ) and t.flag = 'Y' order by t.spoolname";
User.DataBaseConnect(pdfPathSql, ds);
}
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
string pdfpath = ds.Tables[0].Rows[i][0].ToString();
if (string.IsNullOrEmpty(pdfpath))
{
MessageBox.Show("该小票缺少目标存储地址,请与管理员联系!");
continue;
}
if (System.IO.File.Exists(@pdfpath))
{
string filenamestr = pdfpath.Substring(pdfpath.LastIndexOf("\\"));
if (filenamestr.Contains("_"))
{
filenamestr = filenamestr.Substring(filenamestr.IndexOf("_") + 1);
System.IO.File.Copy(pdfpath, pathstr + "\\" + filenamestr, true);
//this.backgroundWorker1.ReportProgress(progressStr, String.Format("当前值是 {0} ", progressStr));
this.backgroundWorker1.ReportProgress(i + 1, String.Format("当前值是 {0} ", i + 1));
}
else
{
System.IO.File.Copy(pdfpath, pathstr + "\\" + filenamestr, true);
//this.backgroundWorker1.ReportProgress(progressStr, String.Format("当前值是 {0} ", progressStr));
this.backgroundWorker1.ReportProgress(i + 1, String.Format("当前值是 {0} ", i + 1));
}
}
else
{
//MessageBox.Show("目标地址未能查找到该管路小票,请与管理员联系!");
continue;
}
}
if (indicator == 0)
{
string drawingstatus = DBConnection.GetDrawingStatus("SP_GETDRAWINGSTATUS", drawing, version);
if (drawingstatus == "1")
{
for (int j = 0; j < ds.Tables[0].Rows.Count; j++)
{
string spoolstr = ds.Tables[0].Rows[j][1].ToString();
int page_no = j + 3;
DBConnection.InsertSpoolPageNo("SP_InsertSpoolPageNo", pid, drawing, spoolstr, page_no);
}
}
}
ds.Dispose();
pathstr = User.rootpath + "\\" + drawing;
if (!Directory.Exists(pathstr))//若文件夹不存在则新建文件夹
{
MessageBox.Show("请确认小票是否已上传");
return;
}
OracleDataReader dr = null;
OracleConnection conn = new OracleConnection(DataAccess.OIDSConnStr);
conn.Open();
OracleCommand cmd = conn.CreateCommand();
cmd.CommandType = CommandType.Text;
if (indicator == 0)
{
cmd.CommandText = "select UPDATEDFRONTPAGE from SP_CREATEPDFDRAWING where PROJECTID = '" + pid + "' AND DRAWINGNO = '" + drawing + "' and FLAG = 'Y'";
}
else
{
cmd.CommandText = "select MODIFYDRAWINGFRONTPAGE from SP_CREATEPDFDRAWING where PROJECTID = '" + pid + "' AND DRAWINGNO = '" + drawing + "' and FLAG = 'Y'";
}
dr = cmd.ExecuteReader();
byte[] File = null;
if (dr.Read())
//.........这里部分代码省略.........
示例5: LoadInitializeValues
private void LoadInitializeValues(Table pTable)
{
gComeMainForm = true;
var vGroups = ProductGroup.GetAllProductGroups();
var ucProductGroups = new ucProductGroups();
ucProductGroups.SetGroups(vGroups, GroupClick);
gbGroups.Controls.Add(ucProductGroups);
cmbTables.ValueMember = "Id";
cmbTables.DisplayMember = "TableName";
tables = Table.GetAllTables();
tables.Insert(0, new Table { Id = -1, TableName = "Seçiniz" });
cmbTables.DataSource = tables;
if (pTable != null)
{
cmbTables.SelectedValue = pTable.Id;
gTable = pTable;
if (pTable.Active)
{
LoadGrid(pTable.Id);
}
}
gComeMainForm = false;
}
示例6: GetChannel
/// <summary>
/// 獲取賣場列表
/// </summary>
/// <returns></returns>
public HttpResponseBase GetChannel()
{
string json = String.Empty;
List<Channel> store = new List<Channel>();
try
{
Channel channel = new Channel();
_channelMgr = new ChannelMgr(mySqlConnectionString);
store = _channelMgr.QueryList(0);
channel.channel_id = 0;
channel.channel_name_simple = "全部";
store.Insert(0, channel);
IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
//这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式
timeConverter.DateTimeFormat = "yyyy-MM-dd";
json = "{success:true,data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}";//返回json數據
}
catch (Exception ex)
{
Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
log.Error(logMessage);
json = "{success:false,data:[]}";
}
this.Response.Clear();
this.Response.Write(json);
this.Response.End();
return this.Response;
}
示例7: GetVendorName
// 廠商下拉列表
public HttpResponseBase GetVendorName()
{
_IiplasMgr = new IplasMgr(mySqlConnectionString);
List<Vendor> stores = new List<Vendor>();
string json = string.Empty;
try
{
Vendor query = new Vendor();
stores = _IiplasMgr.VendorQueryAll(query);
query.vendor_name_simple = "所有廠商名稱";
stores.Insert(0, query);
json = "{success:true,data:" + JsonConvert.SerializeObject(stores) + "}";//返回json數據
}
catch (Exception ex)
{
Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
log.Error(logMessage);
json = "{success:true,totalCount:0,data:[]}";
}
this.Response.Clear();
this.Response.Write(json);
this.Response.End();
return this.Response;
}
示例8: Merge
public static bool Merge(List<PDFFiles> InFiles, string OutFile)
{
try
{
for(int i=0; i<InFiles.Count; i++)
{
PdfReader reader = null;
reader = new PdfReader(InFiles[i].filePath);
if (!reader.IsOpenedWithFullPermissions)
{
string newUnlockedFile = unlockPDF(InFiles[i].filePath); //throw new System.IO.FileLoadException("Cannot merge because \"" + file.fileName + "\" is Locked for editing");
InFiles.Remove(InFiles[i]);
InFiles.Insert(i, new PDFFiles(newUnlockedFile));
}
}
}
catch (FileNotFoundException ex)
{
throw ex;
}
catch (System.IO.FileLoadException)
{
throw;
}
catch
{
return false;
}
try
{
using (FileStream stream = new FileStream(OutFile, FileMode.Create))
using (Document doc = new Document(PageSize.A4))
using (PdfCopy pdf = new PdfCopy(doc, stream))
{
doc.Open();
PdfReader reader = null;
PdfImportedPage page = null;
//fixed typo
InFiles.ForEach(file =>
{
reader = new PdfReader(file.filePath);
for (int i = 0; i < reader.NumberOfPages; i++)
{
page = pdf.GetImportedPage(reader, i + 1);
//doc.SetPageSize(page.Width <= page.Height ? PageSize.A4 : PageSize.A4.Rotate());
pdf.AddPage(page);
}
pdf.FreeReader(reader);
reader.Close();
});
}
}
catch
{
return false;
}
ScaleToA4(OutFile, OutFile);
return true;
}