回复 1楼wuzhiwei的帖子
你好,
目前还无法直接通过 FlexGrid 导出 Image 到 Excel,可以借助 C1Excel 导出图片。
- 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");
复制代码
2.是需要定制报表预览控件的工具条吗?可以通过以下代码控制按钮集合:
- this.c1PrintPreviewControl1.ToolBars.File.ToolStrip.Items.RemoveAt(0);
复制代码 |