string strXml = ds.GetXml();
MessageBox.Show(strXml);
if (ds.Tables[0].Rows.Count!=0)
{

object filename= System.Windows.Forms.Application.StartupPath + "\\变压器负荷计算说明书.doc"; //word文件路径和名称
string xslFileName= System.Windows.Forms.Application.StartupPath + "\\transform.xsl"; //word文件路径和名称
Object Nothing=System.Reflection.Missing.Value; 
Word.Application wordApp=new Word.ApplicationClass(); //建立一个word线程

//建立word中的doc对象
Word.Document wordDoc=wordApp.Documents.Add(ref Nothing,ref Nothing,ref Nothing,ref Nothing);
wordDoc.Range(ref Nothing , ref Nothing).Delete(ref Nothing , ref Nothing);//删除word文档中所有内容 wordDoc.Range(ref Nothing , ref Nothing).InsertXML(strXml,ref Nothing);
wordDoc.TransformDocument(xslFileName,true);
wordDoc.SaveAs(ref filename,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing); 
wordDoc.Close(ref Nothing, ref Nothing, ref Nothing); 
wordApp.Quit(ref Nothing, ref Nothing, ref Nothing); try
{

System.Diagnostics.Process.Start(filename.ToString()); }
catch (System.Exception eOpen)
{
MessageBox.Show("文件打不开!\n"+eOpen.Message);
}-----------
这是以前一个程序员留下的代码,现在我要接着这个项目做下来。
不知道这段程序的原理是什么?最重要的是那个xsl是怎么生成的?对写word有什么作用?
如何生成xsl文件???各位帮帮小弟,不胜感激!!!