本文整理汇总了C#中System.IO.FileStream.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# System.IO.FileStream.ToString方法的具体用法?C# System.IO.FileStream.ToString怎么用?C# System.IO.FileStream.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.FileStream
的用法示例。
在下文中一共展示了System.IO.FileStream.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateReport
private static string GenerateReport()
{
string path = ConfigurationManager.AppSettings["ReportPathOnServer"] + "Daily Activity" + DateTime.Now.ToShortDateString().Replace("/", "_") + ".pdf";
System.IO.File.WriteAllText(@"C:\Users\Public\TestFolder\WriteText.txt", " 1 " + path);
Document doc = new Document(iTextSharp.text.PageSize.A4);
System.IO.FileStream file = new System.IO.FileStream(path, System.IO.FileMode.OpenOrCreate);
System.IO.File.WriteAllText(@"C:\Users\Public\TestFolder\WriteText.txt"," 1 " + file.ToString());
PdfWriter writer = PdfWriter.GetInstance(doc, file);
doc.Open();
PdfPTable tab = new PdfPTable(5);
PdfPCell cell = new PdfPCell(new Phrase("Header"));
cell = ImageCell("~/images/logo.png", 30f, PdfPCell.ALIGN_LEFT);
cell.Colspan = 5;
cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right
//Style
cell.BorderColor = new BaseColor(System.Drawing.Color.Black);
cell.Border = Rectangle.BOTTOM_BORDER; // | Rectangle.TOP_BORDER;
cell.BorderWidthBottom = 1f;
cell.PaddingBottom = 30f;
tab.AddCell(cell);
cell = new PdfPCell(new Phrase("DAILY ACTIVITY REPORT(" + DateTime.Now.ToShortDateString() + ")",
new Font(Font.FontFamily.COURIER, 12F,1,BaseColor.RED)));
cell.Colspan = 5;
cell.HorizontalAlignment = 0; //0=Left, 1=Centre, 2=Right
//Style
// cell.BorderColor = new BaseColor(System.Drawing.Color.Black);
cell.Border = Rectangle.BOTTOM_BORDER; // | Rectangle.TOP_BORDER;
cell.BorderWidthBottom = 1f;
cell.PaddingTop = 18f;
cell.PaddingBottom = 18f;
tab.AddCell(cell);
//add header cells here
tab.AddCell("Date & Time");
tab.AddCell("Username");
// tab.AddCell("Activity");
tab.AddCell("Message");
tab.AddCell("IP");
tab.AddCell("URL");
PdfPCell cellBottom = new PdfPCell();
cellBottom.Colspan = 5;
cellBottom.HorizontalAlignment = 1;
//Style
cellBottom.BorderColor = new BaseColor(System.Drawing.Color.Black);
cellBottom.Border = Rectangle.BOTTOM_BORDER;
cellBottom.BorderWidthBottom = 1f;
cellBottom.PaddingBottom = 5f;
tab.AddCell(cellBottom);
// put up the data now
List<tblActivityLog> lst = new ActivityLogBL().GetTodayLogs();
foreach (var item in lst)
{
tab.AddCell(item.ActivityDate.ToShortDateString());
tab.AddCell(item.UserName);
// tab.AddCell(item.Activity);
tab.AddCell(item.Message);
tab.AddCell(item.IP);
tab.AddCell(item.URL);
}
doc.Add(tab);
doc.Close();
file.Close();
return path;
}