数据集导出到现有的Excel工作表: [英] Dataset Export to existing excel sheet:
本文介绍了数据集导出到现有的Excel工作表:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我能够成功地将数据集填充到新的Excel工作表中.
但是我需要将数据集导出到预定义的excel工作表(具有某些字段的公式)
请给......
Im able to populate the dataset to a new excel sheet successfully.
But i need to export the data set to a predefined excel sheet(with formulas for certain fields)
Kindly advice...
推荐答案
看看: ^ ]
请尝试以下操作:
参考和名称空间:
try the following :
References and namespaces:
using Microsoft.Office.Interop.Excel;
using Microsoft.Office.Interop.InfoPath.Xml;
using System.Xml.Xsl;
using System.Xml;
XmlDataDocument xmlDoc = new System.Xml.XmlDataDocument(CVDtls);
XslCompiledTransform xslTran = new System.Xml.Xsl.XslCompiledTransform();
//Create XmlTextWriter for the FileSteam
//FileStream fs = new System.IO.FileStream("testing.xls",FileMode.OpenOrCreate);
FileStream fs = new System.IO.FileStream(@"C:\EXPORTED\test.xls", FileMode.OpenOrCreate);
XmlTextWriter xtw = new System.Xml.XmlTextWriter(fs, System.Text.Encoding.Unicode);
//Add processing instructions to the beginning of the XML file,X
// one of which indicates a style sheet.
xtw.WriteProcessingInstruction("xml", "version='1.0'");
string strXSLFilename;
strXSLFilename = "test.xsl";
xtw.WriteProcessingInstruction("xml-stylesheet", "type='text/xls' href='" + strXSLFilename + "'");
//Write the XML from the dataset to the file
CVDtls.WriteXml(xtw);
xtw.Close();
引用这些线程,希望对您有所帮助
http://www.ozgrid.com/forum/showthread.php?t=26768& page = 1 [ ^ ]
http://bytes.com/topic/visual-basic/answer/860816-how-append-data-existing-excel-file [
Refer these threads, hope it helps
http://www.ozgrid.com/forum/showthread.php?t=26768&page=1[^]
http://bytes.com/topic/visual-basic/answers/860816-how-append-data-existing-excel-file[^]
这篇关于数据集导出到现有的Excel工作表:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文