日期:2014-05-17 浏览次数:21002 次
private void button1_Click(object sender, RoutedEventArgs e)
{
try
{
//弹出保存文件对话框,保存生成的Word
Form.SaveFileDialog sfd = new Form.SaveFileDialog();
sfd.Filter = "Word Document(*.doc)|*.doc";
sfd.DefaultExt = "Word Document(*.doc)|*.doc";
sfd.RestoreDirectory = true;
if (sfd.ShowDialog() == Form.DialogResult.OK)
{
// 只导出一条医案信息
//**********************************************
object oMissing = System.Reflection.Missing.Value;
// 创建一个Word应用程序实例
Word._Application oWord = new Word.Application();
// 设置为不可见
oWord.Visible = false;
// 模板文件地址,这里假设在X盘根目录
string strCurrentPath = System.Windows.Forms.Application.StartupPath;
object oTemplate = strCurrentPath + "\\MediCaseTemp.dot";
//声明书签数组
object[] oBookMark = new object[2];
//赋值书签名
oBookMark[0] = "image";
oBookMark[1] = "text";