已有56人关注
我使用C#开发宝典中人事管理系统时!正确的引用了东西!在Frm_ManFile窗体的职工基本信息保存数据到word的时候出现 GDI+ 中发生一般性错误。错误位置:(pp.Image.Save(@
发表在C#图书答疑 2015-01-29
是否精华
版块置顶:
    object Nothing = System.Reflection.Missing.Value;
            object missing = System.Reflection.Missing.Value;
            //创建Word文档
            Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
            Microsoft.Office.Interop.Word.Document wordDoc = wordApp.Documents.Add(ref Nothing, ref Nothing, ref Nothing, ref Nothing);
            wordApp.Visible = true;
            //设置文档宽度
            wordApp.Selection.PageSetup.LeftMargin = wordApp.CentimetersToPoints(float.Parse("2"));
            wordApp.ActiveWindow.ActivePane.HorizontalPercentScrolled = 11;
            wordApp.Selection.PageSetup.RightMargin = wordApp.CentimetersToPoints(float.Parse("2"));
            Object start = Type.Missing;
            Object end = Type.Missing;
            PictureBox pp = new PictureBox();//新建一个PictureBox控件
            int p1 = 0;
            for (int i = 0; i < MyDS_Grid.Tables[0].Rows.Count; i++)
            {
                try
                {
                    byte[] pic = (byte[])(MyDS_Grid.Tables[0].Rows[i][23]);//将数据库中的图片转换成二进制流
                    MemoryStream ms = new MemoryStream(pic);//将字节数组存入到二进制流中
                    pp.Image = Image.FromStream(ms);//二进制流Image控件中显示
                  [font color=#FF0000]  pp.Image.Save(@"C:\22.bmp");//将图片存入到指定的路径[/font]
                }
                catch
                {
                    p1 = 1;
                }
分享到:
精彩评论 1
小科_mrkj
学分:43 LV2
2015-01-30
沙发
读者朋友:
    您好,应该是你的C盘权限比较高,把C盘换成其他的一个盘,再试一下。
首页上一页 1 下一页尾页 1 条记录 1/1页
手机同步功能介绍
友情提示:以下图书配套资源能够实现手机同步功能
明日微信公众号
明日之星 明日之星编程特训营
客服热线(每日9:00-17:00)
400 675 1066
mingrisoft@mingrisoft.com
吉林省明日科技有限公司Copyright ©2007-2022,mingrisoft.com, All Rights Reserved长春市北湖科技开发区盛北大街3333号长春北湖科技园项目一期A10号楼四、五层
吉ICP备10002740号-2吉公网安备22010202000132经营性网站备案信息 营业执照