public formPreviews(DetailData data) { InitializeComponent(); datas = data; init(0); this.ppcPrint.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.ppc_MouseWheel); }
private static void createFile(StreamWriter sw, DetailData data) { sw.WriteLine(","+data.Title + ",,,," + data.Today); sw.WriteLine(",,,,,"); sw.WriteLine(data.YourCompanyName + ",,,,,"); sw.WriteLine(data.DeliveryDate + ",,,,,"); sw.WriteLine(data.ConstractionName + ",,,,,"); sw.WriteLine(data.PaymentTerms + ",,,,,"); sw.WriteLine(data.ExpirationDate + ",,,,,"); sw.WriteLine(",,,,"+data.MyChargeName+","); sw.WriteLine(",,,,,"); sw.WriteLine("品名,数量,単位,単価,金額,備考"); foreach (DataGridViewRow row in data.DataContent) { string dRow = ""; for (int i = 0; i < 6;i++ ) { string sSub = ""; if(i!=5){ sSub = ","; } if (row.Cells[i].Value != null) { string line = row.Cells[i].Value.ToString(); line = line.Replace("\r\n", "\n"); line = line.Replace("\n", @"\n"); dRow += line + sSub; } else { dRow += sSub; } } sw.WriteLine(dRow); } }
// public static void saveDetailData(DetailData data) { string fullPath = path+@"\" + DateTime.Now.ToString("yyyyMMdd-HHmmss")+".csv"; StreamWriter sw=null; try { sw = new StreamWriter(fullPath, true, Encoding.UTF8); createFile(sw, data); } catch(DirectoryNotFoundException e){ try { Directory.CreateDirectory(path); sw = new StreamWriter(fullPath, true, Encoding.UTF8); createFile(sw,data); }catch(Exception){ } }finally{ if(sw!=null){ sw.Close(); } } }
// private static void loadDetailData(out DetailData data) { data = new DetailData(); }
public void setDetailData(DetailData d) { this.data = d; }
public formPreviews(DetailData data) { InitializeComponent(); datas = data; }