我想做一套试题管理系统,时间很急,希望朋友们给些意见,多多帮忙。
目前试卷都是word格式的,想要导到试题库中,就要把每个题分割开,然后导到数据库中,有没有相关的资料或是代码,发给我一份.([email protected])
目前试卷都是word格式的,想要导到试题库中,就要把每个题分割开,然后导到数据库中,有没有相关的资料或是代码,发给我一份.([email protected])
解决方案 »
- 请教一个关于lock的问题
- 如何动态生成表单实例
- 关于C/S结构的监控系统心得交流
- 问form action问题
- 啥原因:connectionstring 属性尚未初始化?
- 通过C#代码压缩后路径过长问题。。。
- 请问如何调用其他线程的窗体做为form.showdialog(owner)的owner参数?
- Winforms中DataGridView控件 如何用SqlCommandBuilder类实现 增删改查?
- 要用winform开发一个短信群发的类库,请问要用到哪些知识,哪里有源码?
- 请教
- ContextMenuStrip如何动态加入菜单项并关联click事件
- 分享,某网站验证码识别程序,识别率百分之百
{
try
{
string savepath = "";
FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
savepath = folderBrowserDialog1.SelectedPath;
}
Object Nothing=System.Reflection.Missing.Value;
object filename = savepath + "/" + StoreNum.Text + "库存报表";
Word.Application WordApp=new Word.ApplicationClass();
Word.Document WordDoc=WordApp.Documents.Add(ref Nothing,ref Nothing,ref Nothing,ref Nothing);
WordDoc.Paragraphs.First.Range.Text = "库存报表 [共有:" + storedt.Rows.Count.ToString() + "本书]";
WordDoc.Paragraphs.First.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
Word.Table table=WordDoc.Tables.Add(WordApp.Selection.Range,storedt.Rows.Count+1,6,ref Nothing,ref Nothing);
table.Cell(1,1).Range.Text="ISBN号";
table.Cell(1,2).Range.Text="书名";
table.Cell(1,3).Range.Text="总库存";
table.Cell(1,4).Range.Text="借书库存";
table.Cell(1,5).Range.Text="可借数量";
table.Cell(1,6).Range.Text="已借数量";
for ( int i=0;i<storedt.Rows.Count;i++ )
{
table.Cell(i+2,1).Range.Text = storedt.Rows[i]["Book_ISBN"].ToString();
table.Cell(i+2,2).Range.Text = storedt.Rows[i]["Book_Name"].ToString();
table.Cell(i+2,3).Range.Text = storedt.Rows[i]["Store_Num"].ToString();
table.Cell(i+2,4).Range.Text = storedt.Rows[i]["CanBorrow_Num"].ToString();
table.Cell(i+2,5).Range.Text = storedt.Rows[i]["InShop_Num"].ToString();
table.Cell(i+2,6).Range.Text = storedt.Rows[i]["OutShop_Num"].ToString();
}
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);
parent.statusBar1.Panels[0].Text = "操作提示:库存报表导出成功";
}
catch
{
parent.statusBar1.Panels[0].Text = "操作提示:库存报表导出失败";
}
}
注意要引用Interop.Word.dll