日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > windows >内容正文

windows

StarkSoft题库管理系统(二)--生成word格式试卷

發(fā)布時(shí)間:2025/3/15 windows 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 StarkSoft题库管理系统(二)--生成word格式试卷 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

一、功能介紹
? ? 1、自定義試題庫(kù)管理系統(tǒng)目錄、難易程度,題型,知識(shí)庫(kù)等。
? ? 2、試題錄入。
? ? 3、強(qiáng)大的試題編輯功能,并與通常應(yīng)用編輯工具有共通。
? ? 4、靈活的試卷構(gòu)造功能,用戶可自定義試卷標(biāo)題、試題分類,試題數(shù)量、總分、試題難度系數(shù)等。
? ? 5、人工生成試卷和自動(dòng)生成試卷文檔格式標(biāo)準(zhǔn)通用。能夠合理使用,有效再編輯,保存,方便瀏覽和打印輸出。
? ? 6、題庫(kù)管理,可以隨時(shí)分散和集中管理題庫(kù)數(shù)據(jù)。
二、菜單功能
? ? 1、基礎(chǔ)數(shù)據(jù)維護(hù):試題分類設(shè)置;題型設(shè)置;難易程度;知識(shí)點(diǎn)庫(kù)設(shè)置
? ? 2、題庫(kù)管理:試題錄入
? ? 3、試卷管理:人工生成試卷;自動(dòng)生成試卷;試卷庫(kù)管理

導(dǎo)出試卷到WORD

#region 創(chuàng)建word試卷(直接導(dǎo)出為word)/// <summary>/// 創(chuàng)建word試卷/// </summary>/// <param name="PathName"></param>public void CreateWordFile(string PathName){try{Object Nothing = System.Reflection.Missing.Value;object filename = PathName; //文件保存路徑//1.創(chuàng)建Word文檔Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.ApplicationClass();Microsoft.Office.Interop.Word.Document WordDoc = WordApp.Documents.Add(ref Nothing, ref Nothing, ref Nothing, ref Nothing);//2.添加頁(yè)眉WordApp.ActiveWindow.View.Type = WdViewType.wdOutlineView;WordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekPrimaryHeader;WordApp.ActiveWindow.ActivePane.Selection.InsertAfter("[入職考試試卷]");WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphRight;//設(shè)置右對(duì)齊WordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekMainDocument;//跳出頁(yè)眉設(shè)置WordApp.Selection.ParagraphFormat.LineSpacing = 8f;//設(shè)置文檔的行間距//3.移動(dòng)焦點(diǎn)并換行object count = 14;object WdLine = Microsoft.Office.Interop.Word.WdUnits.wdLine;//換一行;WordApp.Selection.MoveDown(ref WdLine, ref count, ref Nothing);//移動(dòng)焦點(diǎn)WordApp.Selection.TypeParagraph();//插入段落#region 標(biāo)題WordApp.Selection.Font.Size = 20;WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter; // 居中WordApp.Selection.Font.Bold = 1; // 黑體WordApp.Selection.TypeText("xxxx入職考試");WordApp.Selection.TypeParagraph();//WordApp.Selection.TypeParagraph();#endregion//設(shè)置內(nèi)容部分格式WordApp.Selection.Font.Size = 12;WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphLeft; // 居中WordApp.Selection.Font.Bold = 0; // 黑體string sql = @"select * from base_tx";DataTable dt = DataBaseAccess.GetDataTable(sql);for (int i = 0; i < dt.Rows.Count;i++ ){//寫(xiě)標(biāo)題WordApp.Selection.TypeText((i+1)+""+dt.Rows[i]["name"].ToString()+"(每題3分)" + "\n\n"); int txid = Convert.ToInt32(dt.Rows[i]["id"]);//題型IDDataRow[] rows = dtxz.Select("xztxid=" + txid, "xztxid asc");DataTable dttemp = dtxz.Clone();dttemp.Clear();foreach (DataRow dr2 in rows){dttemp.Rows.Add(dr2.ItemArray);} for (int k = 0; k < dttemp.Rows.Count; k++){string sqlstr = @"select * from base_st where id=" + dttemp.Rows[k]["xzstid"] + "";DataTable dtst = DataBaseAccess.GetDataTable(sqlstr);//獲取題目?jī)?nèi)容byte[] bWrite = (byte[])dtst.Rows[0]["contents"];//從數(shù)據(jù)庫(kù)中讀出數(shù)據(jù)string s = System.Text.Encoding.UTF8.GetString(bWrite, 0, bWrite.Length);//開(kāi)始寫(xiě)內(nèi)容 WordApp.Selection.TypeText(s);}}WordDoc.Paragraphs.Last.Range.Text = "文檔創(chuàng)建時(shí)間:" + DateTime.Now.ToString();//“落款”WordDoc.Paragraphs.Last.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphRight;//文件保存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); MessageBoxEx.Show("導(dǎo)出成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);}catch (Exception ex){MessageBoxEx.Show("導(dǎo)出失敗!" + "\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);}}#endregion

附完整源代碼下載:http://www.51aspx.com/Code/StarkSoftExam

轉(zhuǎn)載于:https://www.cnblogs.com/starksoft/p/3940361.html

總結(jié)

以上是生活随笔為你收集整理的StarkSoft题库管理系统(二)--生成word格式试卷的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。