收藏 分享(赏)

知识竞赛题库 (3).doc

上传人:A海阔天空 文档编号:3518373 上传时间:2021-02-01 格式:DOC 页数:27 大小:55.98KB
下载 相关 举报
知识竞赛题库 (3).doc_第1页
第1页 / 共27页
亲,该文档总共27页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

1、.OutsideLineWidth = WdLineWidth.wdLineWidth050pt;/边框宽度 if (width != 0) newTable.PreferredWidth = width;/表格宽度 newTable.AllowPageBreaks = false; return newTable; /合并单元格 表名,开始行号,开始列号,结束行号,结束列号 public void MergeCell(Microsoft.Office.Interop.Word.Table table, int row1, int column1, int row2, int column2)

2、 table.Cell(row1, column1).Merge(table.Cell(row2, column2); /设置表格内容对齐方式 Align水平方向,Vertical垂直方向(左对齐,居中对齐,右对齐分别对应Align和Vertical的值为-1,0,1) public void SetParagraph_Table(Microsoft.Office.Interop.Word.Table table, int Align, int Vertical) switch (Align) case -1: table.Range.ParagraphFormat.Alignment = W

3、dParagraphAlignment.wdAlignParagraphLeft; break;/左对齐 case 0: table.Range.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; break;/水平居中 case 1: table.Range.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphRight; break;/右对齐 switch (Vertical) case -1: table.Range.

4、Cells.VerticalAlignment = WdCellVerticalAlignment.wdCellAlignVerticalTop; break;/顶端对齐 case 0: table.Range.Cells.VerticalAlignment = WdCellVerticalAlignment.wdCellAlignVerticalCenter; break;/垂直居中 case 1: table.Range.Cells.VerticalAlignment = WdCellVerticalAlignment.wdCellAlignVerticalBottom; break;/底

5、端对齐 /设置表格字体 public void SetFont_Table(Microsoft.Office.Interop.Word.Table table, string fontName, double size) if (size != 0) table.Range.Font.Size = Convert.ToSingle(size); if (fontName != ) table.Range.Font.Name = fontName; /是否使用边框,n表格的序号,use是或否 public void UseBorder(int n,bool use) if (use) wordD

6、oc.Content.Tablesn.Borders.Enable = 1; /允许有边框,默认没有边框(为0时报错,1为实线边框,2、3为虚线边框,以后的数字没试过) else wordDoc.Content.Tablesn.Borders.Enable = 2; /允许有边框,默认没有边框(为0时报错,1为实线边框,2、3为虚线边框,以后的数字没试过) /给表格插入一行,n表格的序号从1开始记 public void AddRow(int n) object miss = System.Reflection.Missing.Value; wordDoc.Content.Tablesn.Ro

7、ws.Add(ref miss); /给表格添加一行 public void AddRow(Microsoft.Office.Interop.Word.Table table) object miss = System.Reflection.Missing.Value; table.Rows.Add(ref miss); /给表格插入rows行,n为表格的序号 public void AddRow(int n, int rows) object miss = System.Reflection.Missing.Value; Microsoft.Office.Interop.Word.Table

8、 table = wordDoc.Content.Tablesn; for (int i = 0; i rows; i+) table.Rows.Add(ref miss); /给表格中单元格插入元素,table所在表格,row行号,column列号,value插入的元素 public void InsertCell(Microsoft.Office.Interop.Word.Table table, int row, int column, string value) table.Cell(row, column).Range.Text = value; /给表格中单元格插入元素,n表格的序

9、号从1开始记,row行号,column列号,value插入的元素 public void InsertCell(int n, int row, int column, string value) wordDoc.Content.Tablesn.Cell(row, column).Range.Text = value; /给表格插入一行数据,n为表格的序号,row行号,columns列数,values插入的值 public void InsertCell(int n, int row, int columns, string values) Microsoft.Office.Interop.Wo

10、rd.Table table = wordDoc.Content.Tablesn; for (int i = 0; i columns; i+) table.Cell(row, i + 1).Range.Text = valuesi; /插入图片 public void InsertPicture(string bookmark, string picturePath, float width, float hight) object miss = System.Reflection.Missing.Value; object oStart = bookmark; Object linkToF

11、ile = false; /图片是否为外部链接 Object saveWithDocument = true; /图片是否随文档一起保存 object range = wordDoc.Bookmarks.get_Item(ref oStart).Range;/图片插入位置 wordDoc.InlineShapes.AddPicture(picturePath, ref linkToFile, ref saveWithDocument, ref range); wordDoc.Application.ActiveDocument.InlineShapes1.Width = width; /设置图

12、片宽度 wordDoc.Application.ActiveDocument.InlineShapes1.Height = hight; /设置图片高度 /插入一段文字,text为文字内容 public void InsertText(string bookmark, string text) object oStart = bookmark; object range = wordDoc.Bookmarks.get_Item(ref oStart).Range; Paragraph wp = wordDoc.Content.Paragraphs.Add(ref range); wp.Form

13、at.SpaceBefore = 6; wp.Range.Text = text; wp.Format.SpaceAfter = 24; wp.Range.InsertParagraphAfter(); wordDoc.Paragraphs.Last.Range.Text = n; / 杀掉winword.exe进程 public void killWinWordProcess() System.Diagnostics.Process processes = System.Diagnostics.Process.GetProcessesByName(WINWORD); foreach (Sys

14、tem.Diagnostics.Process process in processes) bool b = process.MainWindowTitle = ; if (process.MainWindowTitle = ) process.Kill(); 第二部分,具体生成文档的编码代码见下文:1,首先需要载入模板Report report = new Report();report.CreateNewDocument(TemPath); /模板路径2,插入一个值report.InsertValue(Bookmark_value, 世界杯);/在书签“Bookmark_value”处插入

15、值3,创建一个表格Table table = report.InsertTable(Bookmark_table, 2, 3, 0); /在书签“Bookmark_table”处插入2行3列行宽最大的表4,合并单元格report.MergeCell(table, 1, 1, 1, 3); /表名,开始行号,开始列号,结束行号,结束列号5,表格添加一行report.AddRow(table); /表名6,在单元格中插入值report.InsertCell(table, 2, 1, R2C1);/表名,行号,列号,值7,设置表格中文字的对齐方式report.SetParagraph_Table(t

16、able, -1, 0);/水平方向左对齐,垂直方向居中对齐8,设置表格字体report.SetFont_Table(table, 宋体, 9);/宋体9磅9,给现有的表格添加一行report.AddRow(1); /给模板中第一个表格添加一行10,确定现有的表格是否使用边框report.UseBorder(1, true); /模板中第一个表格使用实线边框11,给现有的表格添加多行report.AddRow(1, 2); /给模板中第一个表格插入2行12,给现有的表格插入一行数据string values= 英超, 意甲, 德甲, 西甲, 法甲 ;report.InsertCell(1, 2

17、, 5, values); /给模板中第一个表格的第二行的5列分别插入数据12,插入图片string picturePath = C:Documents and SettingsAdministrator桌面1.jpg;report.InsertPicture(Bookmark_picture, picturePath, 150, 150); /书签位置,图片路径,图片宽度,图片高度13,插入一段文字string text = 长期从事电脑操作者,应多吃一些新鲜的蔬菜和水果,同时增加维生素A、B1、C、E的摄入。为预防角膜干燥、眼干涩、视力下降、甚至出现夜盲等,电 脑操作者应多吃富含维生素A的

18、食物,如豆制品、鱼、牛奶、核桃、青菜、大白菜、空心菜、西红柿及新鲜水果等。;report.InsertText(Bookmark_text, text);14,最后保存文档report.SaveDocument(RepPath); /文档路径第四步,运行程序生成文档,并查看生成的文档自动生成的文档如下图测试中遇到的BUG1. 出现两个对话框,一个对话框提示“(前面省略)被呼叫方拒绝接收呼叫。(Exception from HRESULT:0x80010001 (RPC_E_CALL_REJECTED)”;另一个对话框提示“*(此处是模板文件名)”中的拼写或语法错误过多,无法继续显示。如果要检查

19、此文档的拼写和语法,请选择“工具”菜单中的“拼写和语法”命令。”。分析原因:这可能是由于Word中有对英文的拼写和语法有自动检测的功能,而使某些字母组合被认为是语法错误。解决方案:选择“工具”菜单中的“拼写和语法”命令,将所有“不在词典中:”的红色字体“添加到词典”,如下图所示:注意:如果程序自动生成报告失败,那么程序中调用的模板的进程不会自动结束,需要在任务管理器中手动删除模板的进程“WINWORD.EXE”。测试环境操作系统:Windows XP sp3语言:c#编译器:Microsoft Visual Studio 2005框架版本:Microsoft .NET Framework 2.

20、0Office版本:Microsoft Office 2003结束.Were Just Beginning从零开始By Charles F. KatteringBGM:夏終海(夏末的海)-岸部真明“We are reading the first verse of the first chapter of a book whose pages are infinite .”“我们正在读一本书的第一章第一行,而这本书有无数页” I do not know who wrote these words, but I have always liked them as a reminder that

21、the future can be anything we want to make it.我不知道这句话是谁写的,可我很喜欢。它提醒着我们,未来是由自己创造的,一切皆有可能。We can take the mysterious, hazy future and carve out of it anything that we can imagine, just as a sculptor carves a statue from a shapeless stone.我们可以把神秘的、不可知的未来塑造成我们想象中的任何一种样子,就像雕塑家把一尊未成形的石头刻成雕像。We are all in

22、the position of the farmer. If we plant a good seed, we reap a good harvest. If our seed is poor and full of weeds, we reap a useless crop. If we plant nothing at all, we harvest nothing at all.我们就像是农夫。如果我们播下良种,必将获得丰收。然而,如果播下劣种,或田间杂草丛生,我们收获的就是无用的庄稼。没有耕耘就不会有收获。 I want the future to be better than the

23、 past. I dont want it contaminated by the mistakes and errors with which history is filled. We should all be concerned about the future because that is where we will spend the remainder of our lives.我希望未来比过去更加美好。我希望未来不再重蹈历史的错误与过失。我们应该专注于未来,因为我们的余生都将在未来中度过。The past is gone and static. Nothing we can

24、do will change it. The future is before us and dynamic. Everything we do will affect it.往昔已逝,静如止水,我们无力改变它。未来就在眼前,生机勃勃,我们所做的一切都会影响它。Each day brings with it new frontiers, in our homes and in our businesses, if we will only recognize them. We are just at the beginning of the progress in every field of

25、 human endeavor.如果我们意识到这些,无论是工作还是家庭,我们都能开拓一片新天地。在人类致力开拓的每一个领域里,我们正好站在进步的起跑点上。TheseThingsShallNeverDieCharlesJohnHuffamDickens这些美好不会消逝查尔斯狄更斯Thepure,thebright,thebeautiful,Thatstirredourheartsinyouth,Theimpulsestowordlessprayer,Thedreamsofloveandtruth;Thelongingaftersomethingslost,Thespiritsyearningcr

26、y,Thestrivingafterbetterhopes-Thesethingscanneverdie.Thetimidhandstretchedforthtoaid,Abrotherinisneed,AkindlywordingriefsdarkhourThatprovesafriendindeed;Whenjusticethreatensnigh,Thesorrowofacontriteheart-Thesethingsshallneverdie.LetnothingpassforeveryhandMustfindsomeworktodo;Losenotachancetowakenlov

27、e-Befirm,andjustandtrue;SoshallalightthatcannotfadeBeamontheefromonhigh.Andangelvoicessaytothee-Thesethingsshallneverdie.BGM:Joytotheworld-KevinKernThoughthereismuchtobeconcernedabout,thereisfar,farmoreforwhichtobethankful.Thoughlifesgoodnesscanattimesbeovershadowed,itisneveroutweighed.尽管有很多事让人忧虑,但相

28、比而言,值得感激的事要多得多。尽管生命的美好有时被蒙上阴影,但它却永远不会被埋没。Foreverysingleactthatissenselesslydestructive,therearethousandsmoresmall,quietactsoflove,kindnessandcompassion.Foreverypersonwhoseekstohurt,therearemany,manymorewhodevotetheirlivestohelpingandtohealing.相对于每一个无谓的破坏行为而言,都有更多数以千计更为微小的,包含着爱,友善和同情的举动静静地上演着。相对于每一个试

29、图伤害他人的人而言,都有更多的人致力于帮助他人,治愈他人的创伤。Thereisgoodnesstolifethatcannotbedenied.生命的美好不能否认。Inthemostmagnificentvistasandinthesmallestdetails,lookclosely,forthatgoodnessalwayscomesshiningthrough.在最为壮观的前景和最为琐碎的细节中,请仔细观察,因为美好的事物总是散发着耀眼的光芒闪亮登场。Thereisnolimittothegoodnessoflife.Itgrowsmoreabundantwitheachnewencou

30、nter.Themoreyouexperienceandappreciatethegoodnessoflife,themorethereistobelived.生命的美好没有界限。每一次相遇都会使这美好变得越发丰富。你经历得越多,越能欣赏生命的美好,生命中的美好就会变得越多。Evenwhenthecoldwindsblowandtheworldseemstobecoveredinfoggyshadows,thegoodnessoflifeliveson.Openyoureyes,openyourheart,andyouwillseethatgoodnessiseverywhere.即使当寒风袭

31、来,整个世界似乎被雾气掩盖之时,生命的美好仍会存在。睁开双眼,打开心扉,你就会发现这美好无处不在。Thoughthegoodnessoflifeseemsattimestosuffersetbacks,italwaysendures.Forinthedarkestmomentitbecomesvividlyclearthatlifeisapricelesstreasure.Andsothegoodnessoflifeismadeevenstrongerbytheverythingsthatwouldopposeit.尽管生命的美好有时似乎遭受挫折,但它总会挺过来。因为,在最黑暗的时刻,有一点变

32、得格外清楚,那就是,生命是无价的财富。因此,下正是与生命的美好相对立的事物使其越发强大。Timeandtimeagainwhenyoufeareditwasgoneforeveryoufoundthatthegoodnessoflifewasreallyonlyamomentaway.Aroundthenextcorner,insideeverymoment,thegoodnessoflifeistheretosurpriseanddelightyou.无数次地,当你担心这美好已经远离之时,你会发现生命的美好其实只与你相隔须臾。它就在下一角落,存在于每个时刻之间,等着给你惊喜。Takeamom

33、enttoletthegoodnessoflifetouchyourspiritandcalmyourthoughts.Then,shareyourgoodfortunewithanother.Forthegoodnessoflifegrowsmoreandmoremagnificenteachtimeitisgivenaway.花些时间让生命的美好感动自己的灵魂,放松自己的思绪。然后,把你的幸运与他人分享。因为生命的美好会在每次给予之间变得越来越壮观。Thoughtheproblemsconstantlyscreamforattentionandtheconflictsappeartorag

34、eeverstronger,thegoodnessoflifegrowsstrongerstill,quietly,peacefully,withmorepurposeandmeaningthaneverbefore.ThelaneKeLing巷柯灵(节选)BGM:茉莉.想念Thelane,thoughcutofffromthehustleandbustleofbusycities,doesnottasteofthecountrysideatall.Itislonganddeep,soitwilltakeyoualongwhiletowalkpatientlyandquietlythrough

35、itfromendtoend.这种小巷,隔绝了市廛的红尘,却又不是乡村的风味。它又深又长,一个人耐心静静走去,要老半天才走完。Itisalsosowindingthatitseemstobeablindalleywhenyoulookfarahead,butifyoukeepwalkinguntilyoutakeaturning,youllfinditagainlyingendlessandstillmorequiet.它又这么曲折,你望前面,好像已经堵塞了,可是走过去,一转弯,依然是巷陌深深,而且更加幽静。Thereisnothingbutstillnessthere.Atanyhourof

36、day,youcanevendistinctlyhearinthedusk-likequietyourownfootsteps.那里常是寂寂的,寂寂的,不论什么时候,你向巷中踅去,都如宁静的黄昏,可以清晰地听到自己的足音。Oneithersideofthelanestandenclosingwallsofmediumheight,which,moss-coveredandhungwithclustersoffreshgreenwisteria,lookalmostlikescreensofprimitivesimplicity.不高不矮的围墙挡在两边,斑斑驳驳的苔痕,墙上挂着一串串苍翠欲滴的藤

37、萝,简直像古朴的屏风。Insidethewallsareresidentsgardenswithdensegrovesoftallbamboosaswellassoftsoundsofnature.Inspring,beautifulpeachandapricotblossomsatopthewalls,likegracefulgirlswavingtheiredsleeves,willswayhospitablytobeckonthepedestrians.墙里常是人家的竹园,修竹森森,天籁细细;春来时还常有几枝娇艳的桃花杏花,娉娉婷婷,从墙头殷勤地摇曳红袖,向行人招手。Youllfindthedoorsinthewallscloseshutwithoutasoulinsightbecausetheyarebackdoorstosomehouseholds.Occasionally,youmaycomeuponadoglyingthere,which,h

展开阅读全文
相关资源
相关搜索
资源标签

当前位置:首页 > 应用文书 > 工作计划

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:文库网官方知乎号:文库网

经营许可证编号: 粤ICP备2021046453号世界地图

文库网官网©版权所有2025营业执照举报