C1FlexGrid控件内的数据怎样导出成Excel
1个回答
展开全部
我刚好在用这款控件,大体看了下,给你个解决方案:
c1FlexGrid1[2, 1] = "abc";
c1FlexGrid1.SetCellImage(2, 2, Image.FromFile(@"C:UsersPublicPicturesSample PicturesChrysanthemum.jpg"));
XLSheet sheet = c1XLBook1.Sheets[0];
sheet[2, 1-1].Value = c1FlexGrid1[2, 1];
int width = (int)(((double)sheet.DefaultColumnWidth) * (1.0 / 1440.0) * this.c1FlexGrid1.CreateGraphics().DpiY);
int height = (int)(((double)sheet.DefaultRowHeight) * (1.0 / 1440.0) * this.c1FlexGrid1.CreateGraphics().DpiY);
Bitmap img = new Bitmap(c1FlexGrid1.GetCellImage(2, 2), width, height);
sheet[2, 2-1].Value = img;
c1XLBook1.Save(@"C:MyExcel.xlsx");
System.Diagnostics.Process.Start(@"C:MyExcel.xlsx");
c1FlexGrid1[2, 1] = "abc";
c1FlexGrid1.SetCellImage(2, 2, Image.FromFile(@"C:UsersPublicPicturesSample PicturesChrysanthemum.jpg"));
XLSheet sheet = c1XLBook1.Sheets[0];
sheet[2, 1-1].Value = c1FlexGrid1[2, 1];
int width = (int)(((double)sheet.DefaultColumnWidth) * (1.0 / 1440.0) * this.c1FlexGrid1.CreateGraphics().DpiY);
int height = (int)(((double)sheet.DefaultRowHeight) * (1.0 / 1440.0) * this.c1FlexGrid1.CreateGraphics().DpiY);
Bitmap img = new Bitmap(c1FlexGrid1.GetCellImage(2, 2), width, height);
sheet[2, 2-1].Value = img;
c1XLBook1.Save(@"C:MyExcel.xlsx");
System.Diagnostics.Process.Start(@"C:MyExcel.xlsx");
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |