解决方案 »

  1.   

    需要调用Excel内置的对象,将图片赋值到windows剪贴板,然后再从剪贴板把图片放到你要的任何地方,例如二进制文件。
      

  2.   


    图片在 Excel 中叫做 Shape,你应该遍历 Shapes 集合。
      

  3.   


    图片在 Excel 中叫做 Shape,你应该遍历 Shapes 集合。
    请问有示例代码吗?
      

  4.   

    C#读取Excel中的图片private string exclePath  = @"E:\111.xls";
    private int StartRow = 2; //读的起始行
    private void button1_Click(object sender, System.EventArgs e)
    {
    Excel.Application excel = new Excel.Application();//引用Excel对象
    Excel.Workbook workbook = excel.Workbooks.Add(exclePath);
    excel.UserControl = true;
    System.Text.StringBuilder sb = new System.Text.StringBuilder();
    excel.Visible = false;
    for (int i = 0; i < workbook.Worksheets.Count; i++)//循环取所有的Sheet.
    {
    Excel.Worksheet sheet = workbook.Worksheets.get_Item(i + 1) as Excel.Worksheet;//从1开始.
    for (int row = StartRow; row <= sheet.UsedRange.Rows.Count; row++)
    {
    //取单元格值;
    for (int col = 1; col <= sheet.UsedRange.Columns.Count; col++)
    {
    Excel.Range range =sheet.Cells[row, col] as Excel.Range;
    sb.Append("," + col.ToString() + ":" + range.Text);
    }
    sb.Append(System.Environment.NewLine);
    //取存图片;
    if(sheet.Shapes.Count > row - StartRow )
    {
    Excel.Shape s = sheet.Shapes.Item(row - StartRow + 1) as Excel.Shape;
    s.CopyPicture(Appearance.Button, Excel.XlCopyPictureFormat.xlBitmap); //COPY到内存。
    IDataObject iData = Clipboard.GetDataObject();
    if (iData.GetDataPresent(DataFormats.Bitmap))
    {
    pictureBox1.Image = (Bitmap)iData.GetData(DataFormats.Bitmap); //从内存取值;
    pictureBox1.Image.Save(string.Format(@"D:\{0}.jpg", row)); //保存。
    }
    else
    {
    pictureBox1.Image = null;
    }
    }
    }
    }
    workbook.Close(false,null,null);
    excel.Quit();
    }图片在 Excel 中叫做 Shape,你应该遍历 Shapes 集合。
    请问有示例代码吗?