高手,菜鸟请教:我想将一EXCEL的sheet拷贝到clipboard,(含图片和文字),然后想将它粘贴到自己程序的窗体上,实在不知道怎么做,很多资料都是excel内部粘贴,图文需要如何DataFormats,我试了下,可以直接粘贴在画图里,看来应该是有办法。我其实是想预揽,有无其他办法,比如直接打印输出到我的窗体,但我不想直接嵌入excel.万分感谢!

解决方案 »

  1.   

    我找网上找到一个转换的东西。你可以先转换了在显示<html>
    <head>
    <title>word2Html</title>
    <script language="JAVAscript">
    function convert2html(){
        html.value = word.innerHTML;    
    }
    </script>
    </head>
    <body>
    <p>请在这里贴入WORD文件内容
    <div style="border:1 outset #ffffff; overflow:auto;width:80%;height:50%" id="word" contenteditable></div>
    <input type="button" value="转换成HTML" onclick="convert2html()"><br>
    <textarea cols="80" rows="10" id="html"></textarea><br>
    注意:您的浏览器必须是IE5.5后以上,否则无法插入文字!
    </body></html>
      

  2.   

    它可以支持excel,我也正在弄这方面的东西。感觉不是很好
      

  3.   

    使用Ctr+V复制Excel内容后,直接使用GetImage就可以了,代码如下:private Image excelImage;
    private void button1_Click(object sender, EventArgs e)
    {
    excelImage = Clipboard.GetImage();
    if (img != null)
    {
    PrintPreviewDialog pd = new PrintPreviewDialog();
    using (PrintDocument document = new PrintDocument())
    {
    document.PrintPage += new PrintPageEventHandler(document_PrintPage);
    pd.Document = document;
    }
    pd.ShowDialog(this);
    img.Dispose();
    }
    }void document_PrintPage(object sender, PrintPageEventArgs e)
    {
    e.Graphics.DrawImage(this.BackgroundImage, 0, 0);
    }
      

  4.   

    感谢各位,我发现,其实粘贴的是Bitmap格式就搞定了。