Office操作题生成与自动判分的C#语言实现
Office OperationTest Generation and Automatic Judgment of C# Language GAO Shang-xiong
(Wulanchabu Vocational College Inner Mongolia, Jining 012000,China)
: Through the paperless examination of Office operation test generation and automatic judgment analysis, this paper uses the test operation test generation C/S architecture for Word and Excel and automatic judgment realization are discussed using C# language. 各种计算机应用基础考试系统都离不开office中Word、Excel、PPT考试,考试时都打开这三种软件作题,最后保存,最终由计算机的自动判分程序对保下来的文档进行判分,在这里我们分析这一个过程的实现。 1 软件实现的架构
基于网络的软件实现有B/S和C/S两种架构,前者浏览器服务器模式,后都客户端服务器模式。基于浏览器服务器模式的Office操作题的考试实现,一般采用:浏览器显示试题——浏览器打开真实Office软件——作题——保存——浏览器交卷时将Office文档上传到服务器——在服务端实现自动判分,这种
模式客户端任务轻,在浏览器中实现试题的显示调用上传,在Office软件实现真实的考试环境,此模式维护方便,更改操作题容易,只需更改数据库试题的内容和服务器的判分程序,缺点为加重服务器工作任务,为此我们通常将判分工作放在考试结束后执行。基于客户端服务器模式的Office操作题的考试实现,一般采用:客户端显示试题——客户端调用真实的Office软件——作题——保存——客户端自动判分——提交分数到服务器。这种模式不需要上传Office文档,只需要上传分数,网络负担减轻,考完即可知道分数,缺点就是维护麻烦,更改数据库中试题内容后,客户端要更改对应试题判分程序。 2 Office操作题自动判分的C#语言实现
Office操作题自动判分都是对Office操作文档中保存下来考生作的内容进行判分,随机抽取不同的题,调用对应不同的程序进行判分,下面为客户端实现Word、Excel生成试题与判分的程序及调用。
1) 生成Word试题与自动判分程序及调用: class WordScore {
public static Word.ApplicationClass WordApp = null; public static Word.Document WordDoc = null; public object FileName = \; public static float Score = 0f;
public void CreatePaper(string Content)//生成试卷
{ try
{ object a = Missing.Value; object start = (object)(0); object end = (object)(0); WordApp = new ApplicationClass(); WordApp.Visible = true;
if (File.Exists(FileName.ToString())) { WordDoc = WordApp.Documents.Open(ref FileName, ref a, ref a, ref a, ref a, ref a, ref a, ref a, ref a, ref a, ref a, ref a); } else
{ WordDoc = WordApp.Documents.Add(ref a, ref a, ref a, ref a); }
WordDoc.Range(ref start, ref end).Text = Content; WordDoc.SaveAs(ref FileName, ref a, ref a, ref a, ref a, ref a, ref a, ref a, ref a, ref a, ref a); }
catch (Exception ex)
{ MessageBox.Show(\生成试卷时发生错误!原因是:\ex.Message, \提示\, MessageBoxButtons.OK,
Office操作题生成与自动判分的C#语言实现-2019年文档
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)