...提交后网页中显示的表格怎么那么大,和word中复制的网页不一样,...
刚好前段时间弄过。
我把大致的代码粘上你看下吧。
是C#的。
和你说下思路吧,先在WORD中画好要打印的表,并且设置好,横向的可以在“文件”->;“页面设置”里设置。
然后把要绑定数据库的部分插入书签。
打印的时候调用设计好的那个WORD文件把数据库的内容绑定到书签就行了。
首先要在程序中引入COM组件中的Microsoft Word 11。
安装的word中要包括.net编程组件和Interop(默认是不安装的)。
public void bindAndPrint(){ //绑定Work和数据库Microsoft.Office.Interop.Word.Application app = null;Microsoft.Office.Interop.Word.Document doc = null;object missing = System.Reflection.Missing.Value;object templateFile = Application.StartupPath + @"\word模板.doc";try{app = new Microsoft.Office.Interop.Word.ApplicationClass();doc = app.Documents.Add(ref templateFile, ref missing, ref missing, ref missing);try{foreach (Microsoft.Office.Interop.Word.Bookmark bm in doc.Bookmarks){bm.Select();string item = bm.Name;if (item.Equals("title")) //word中的书签名"title"{bm.Range.Text = title; //title为要替换书签的变量, //即可以将数据库中的值读入title中}}}catch{ } //打印 doc.PrintOut(ref missing, ref missing, ref missing, ref missing,ref missing, ref missing, ref missing, ref missing, ref missing,ref missing, ref missing, ref missing, ref missing, ref missing,ref missing, ref missing, ref missing, ref missing);}catch (Exception exp){MessageBox.Show(exp.Message, this.Text);} //结束word进程 finally{object saveChange = Microsoft.Office.Interop.Word.WdSaveOptions.wdDoNotSaveChanges;if (doc != null) doc.Close(ref saveChange, ref missing, ref missing);if (app != null) app.Quit(ref missing, ref missing, ref missing);} break;} 希望能帮到你!
C++编程,如何添加 Microsoft Word 的对象库的引用和使用Word的自...
using Microsoft.Office.Interop.Word; //导出Word引用至于检索,我还没有研究过。
示例代码:Word.Document mydoc = new Word.Document();//实例化Word文档对象Word.Table mytable;//声明Word表格Word.Selection mysel;//声明Word选区Object myobj;if (dGV.Rows.Count == 0)return;//建立Word对象Word.Application word = new Word.Application();myobj = System.Reflection.Missing.Value;mydoc = word.Documents.Add(ref myobj, ref myobj, ref myobj, ref myobj);word.Visible = true;mydoc.Select();mysel = word.Selection;//将数据生成Word表格文件mytable = mydoc.Tables.Add(mysel.Range, dGV.RowCount, dGV.ColumnCount, ref myobj, ref myobj);//设置列宽mytable.Columns.SetWidth(80, Word.WdRulerStyle.wdAdjustNone);//输出列标题数据for (int i = 0; i {mytable.Cell(1, i + 1).Range.InsertAfter(dGV.Columns[i].HeaderText);}//输出控件中的记录for (int i = 0; i {for (int j = 0; j {mytable.Cell(i + 2, j + 1).Range.InsertAfter(dGV[j, i].Value.ToString());}}
vb.net 后台获取word中表格
'转到表格Public Sub GotoTheTable(ByVal ntable As Integer)Dim missing = System.Reflection.Missing.ValueDim what = Word.WdGoToItem.wdGoToTableDim which = Word.WdGoToDirection.wdGoToFirstDim count = ntableoWordApplic.Selection.GoTo(what, which, count, missing)oWordApplic.Selection.ClearFormatting()oWordApplic.Selection.Text = ""orange = oDocument.Tables(ntable).Cell(1, 1).Rangeorange.Select()End Sub
PTE 听力分数怎么算的
展开全部 1.Summarize Spoken Text这种题目可以说考听力的同时也在考写作,听一段演讲,10min内写出一段50-70字的summary。
察了听和写两部分。
还是考察大家记笔记能力。
每题对应的分数是10分。
分值等价贡献给听力以及写作。
2.Multiple-choice,choose multiple answers这种题型是大家比较熟悉的题型,在听前屏幕上会先出现题目和选项,大家可以提前阅读题目及选项,这在某些方面降低了听时的压力。
每题理论最高分数是4分,通常情况下是2-3分。
分值只影响听力。
3.Fill in the blanks听短文,把中间空缺的词填上。
空的数量是比较多的。
可以在草稿上把词记下来,然后再填上去。
对于大多数人就直接打上去基本不可能,这样做很容易把后句里面的词漏听。
听的时候肯定会遇到生词,但是大家不要慌。
每题理论最高分数是6分,通常情况下是4-5分。
分值等价贡献给听力以及写作。
4.Highlight Correct Summary听力和阅读的双重考查。
主旨题考察应试者对全文的概括分析能力,所以不要求太过于细节。
选项里的正确答案很明显 ,可以在录音结束或之前就能选出来。
每题对应的分值是1分。
分值等价贡献给阅读以及听力。
5.Multiple-choice,choose single answers单选题,同样在听之前可以看到问题和选项的,可以帮助我们有针对性的听。
6.Select Missing Word听某一主题的文章,在文章的结尾会听到“嘟”的一声把原文内容屏蔽,在听之前是可以看到问题和答案的,可以帮助我们有针对性的听。
对应的最高分数是1分。
分值只影响听力。
7.Highlight incorrect words边听边看文本,标出不同于原文的单词。
这题相对比较简单,考查大家对单词读音的辨别能力。
大家在听时,眼睛和耳朵都要高度集中,争取把所有错的单词都挑出来。
每题理论最高分数是5分,通常情况下是3-4分。
分值等价贡献给听力以及阅读。
8.Write from dictation即听写句子,这部分机经的命中率很高,建议考试前背背,可以听力多拿十几分,一定注意听单词的单复数!听时可以只写一部分,结束回来再补全,作者:爱米_b306链接:来源:简书简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
PHP读取word文档内容的方法
jeyyu的代码中浏览器中执行时需要降低浏览器的安全设置,不方便,而且取得的内容只是到剪贴板你可以试试SOAOffice中间件,这个是专门读写word的类,联系科翰索要php代码示例 你说的是端口问题吧,最近SOAOffice中间件推出了免端口版本。
个人体会,SOAOffice编程调用上,要比金格的全文批注简单得多
C#如何实现Word文档接受所有修订后另存
1、在Word文档中插入一个书签,书签名称为“tl”;2、新建一个C#项目,然后在引用中添加Word类库;由于我使用的是Office2007,因此选择的是"Microsoft Word 12.0 Object Library",如果你使用的是Office2003,就应该选择11.0;3、在代码顶部添加对Word类库的引用;using Word = Microsoft.Office.Interop.Word;4、打开Word文档object missingValue = System.Reflection.Missing.Value; object myTrue = false; //不显示Word窗口 object fileName = @"F:\Doc1.doc"; Word._Application oWord = new Word.ApplicationClass(); Word._Document oDoc; oDoc = oWord.Documents.Open(ref fileName, ref missingValue, ref myTrue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue);5、找到刚才添加的书签(注释部分为跳转至标签位置并添加文本的三种方法,做其他参考)/*方法一:使用Word应用程序变量,使用这种方法,wordApp.Documents.Open()中确保isVisible的值为trueif (wordApp.ActiveDocument.Bookmarks.Exists("BM_TEST")){wordApp.ActiveDocument.Bookmarks.get_Item(ref bk).Select();wordApp.Selection.TypeText("insert text"); // 插入文本 }方法二:使用Word文档变量if (wordDoc.Bookmarks.Exists("BM_TEST")){wordDoc.Bookmarks.get_Item(ref bk).Range.Text = "insert text"; // 插入文本}方法三:使用Goto函数,跳转到指定书签object BookMarkName = "BM_TEST";object what = MSWord.WdGoToItem.wdGoToBookmark;wordDoc.ActiveWindow.Selection.GoTo(ref what, ref Nothing, ref Nothing, ref BookMarkName);wordDoc.ActiveWindow.Selection.TypeText("Hello!");*/object tmp = "t1"; Word.Range startRange = oWord.ActiveDocument.Bookmarks.get_Item(ref tmp).Range;6、删除在该位置的表格Word.Table tbl = startRange.Tables[1];tbl.Delete();如果书签所在的位置并没有插入表格,程序并不会删除该位置下面的表格,而是会抛出异常,报错。
7、插入表格,并划线//添加表格oDoc.Tables.Add(startRange, 5, 4, ref missingValue, ref missingValue);//为表格划线startRange.Tables[1].Borders[WdBorderType.wdBorderTop].LineStyle = WdLineStyle.wdLineStyleSingle;startRange.Tables[1].Borders[WdBorderType.wdBorderLeft].LineStyle = WdLineStyle.wdLineStyleSingle;startRange.Tables[1].Borders[WdBorderType.wdBorderRight].LineStyle = WdLineStyle.wdLineStyleSingle;startRange.Tables[1].Borders[WdBorderType.wdBorderBottom].LineStyle = WdLineStyle.wdLineStyleSingle;startRange.Tables[1].Borders[WdBorderType.wdBorderHorizontal].LineStyle = WdLineStyle.wdLineStyleSingle;startRange.Tables[1].Borders[WdBorderType.wdBorderVertical].LineStyle = WdLineStyle.wdLineStyleSingle;全部的代码如下:object missingValue = System.Reflection.Missing.Value; object myTrue = false; //不显示Word窗口 object fileName = @"F:\Doc1.doc"; Word._Application oWord = new Word.ApplicationClass(); Word._Document oDoc; oDoc = oWord.Documents.Open(ref fileName, ref missingValue, ref myTrue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue); try { object tmp = "t1"; Word.Range startRange = oWord.ActiveDocument.Bookmarks.get_Item(ref tmp).Range; //删除指定书签位置后的第一个表格 Word.Table tbl = startRange.Tables[1]; tbl.Delete(); //添加表格 oDoc.Tables.Add(startRange, 5, 4, ref missingValue, ref missingValue); //为表格划线 startRange.Tables[1].Borders[WdBorderType.wdBorderTop].LineStyle = WdLineStyle.wdLineStyleSingle; startRange.Tables[1].Borders[WdBorderType.wdBorderLeft].LineStyle = WdLineStyle.wdLineStyleSingle; startRange.Tables[1].Borders[WdBorderType.wdBorderRight].LineStyle = WdLineStyle.wdLineStyleSingle; startRange.Tables[1].Borders[WdBorderType.wdBorderBottom].LineStyle = WdLineStyle.wdLineStyleSingle; startRange.Tables[1].Borders[WdBorderType.wdBorderHorizontal].LineStyle = WdLineStyle.wdLineStyleSingle; startRange.Tables[1].Borders[WdBorderType.wdBorderVertical].LineStyle = WdLineStyle.wdLineStyleSingle; } catch { //异常处理 } object bSaveChange = true; oDoc.Close(ref bSaveChange, ref missingValue, ref missingValue); oDoc = null; oWord = null;
C# 代码一句代码 object Nothing = System.Reflection.Missing.Value 什...
展开全部 刚刚实现了个功能:用C#实现动态生成Word文档,在Word文档中插入表格,并将读出的数据填入到表格中。
要使用C#操作word,首先要添加引用: 1、添加引用->COM->Microsoft Word 11.0 Object Library 2、在.cs文件中添加using Word;下面的例子中包括C#对Word文档的创建、插入表格、设置样式等操作:(例子中代码有些涉及数据信息部分被省略,重要是介绍一些C#操作word文档的方法) public string CreateWordFile(string CheckedInfo) ...{ string message = ""; try ...{ Object Nothing = System.Reflection.Missing.Value; Directory.CreateDirectory("C:/CNSI"); //创建文件所在目录 string name = "CNSI_" + DateTime.Now.ToShortString()+".doc"; object filename = "C://CNSI//" + name; //文件保存路径 //创建Word文档 Word.Application WordApp = new Word.ApplicationClass(); Word.Document WordDoc = WordApp.Documents.Add(ref Nothing, ref Nothing, ref Nothing, ref Nothing); //添加页眉 WordApp.ActiveWindow.View.Type = WdViewType.wdOutlineView; WordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekPrimaryHeader; WordApp.ActiveWindow.ActivePane.Selection.InsertAfter("[页眉内容]"); WordApp.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight;//设置右对齐 WordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekMainDocument;//跳出页眉设置 WordApp.Selection.ParagraphFormat.LineSpacing = 15f;//设置文档的行间距 //移动焦点并换行 object count = 14; object WdLine = Word.WdUnits.wdLine;//换一行; WordApp.Selection.MoveDown(ref WdLine, ref count, ref Nothing);//移动焦点 WordApp.Selection.TypeParagraph();//插入段落 //文档中创建表格 Word.Table newTable = WordDoc.Tables.Add(WordApp.Selection.Range, 12, 3, ref Nothing, ref Nothing); //设置表格样式 newTable.Borders.OutsideLineStyle = Word.WdLineStyle.wdLineStyleThickThinLargeGap; newTable.Borders.InsideLineStyle = Word.WdLineStyle.wdLineStyleSingle; newTable.Columns[1].Width = 100f; newTable.Columns[2].Width = 220f; newTable.Columns[3].Width = 105f; //填充表格内容 newTable.Cell(1, 1).Range.Text = "产品详细信息表"; newTable.Cell(1, 1).Range.Bold = 2;//设置单元格中字体为粗体 //合并单元格 newTable.Cell(1, 1).Merge(newTable.Cell(1, 3)); WordApp.Selection.Cells.VerticalAlignment = Word.WdCellVerticalAlignment.wdCellAlignVerticalCenter;//垂直居中 WordApp.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;//水平居中 //填充表格内容 newTable.Cell(2, 1).Range.Text = "产品基本信息"; newTable.Cell(2, 1).Range.Font.Color = Word.WdColor.wdColorDarkBlue;//设置单元格内字体颜色 //合并单元格 newTable.Cell(2, 1).Merge(newTable.Cell(2, 3)); WordApp.Selection.Cells.VerticalAlignment = Word.WdCellVerticalAlignment.wdCellAlignVerticalCenter; //填充表格内容 newTable.Cell(3, 1).Range.Text = "品牌名称:"; newTable.Cell(3, 2).Range.Text = BrandName; //纵向合并单元格 newTable.Cell(3, 3).Select();//选中一行 object moveUnit = Word.WdUnits.wdLine; object moveCount = 5; object moveExtend = Word.WdMovementType.wdExtend; WordApp.Selection.MoveDown(ref moveUnit, ref moveCount, ref moveExtend); WordApp.Selection.Cells.Merge(); //插入图片 string FileName = Picture;//图片所在路径 object LinkToFile = false; object SaveWithDocument = true; object Anchor = WordDoc.Application.Selection.Range; WordDoc.Application.ActiveDocument.InlineShapes.AddPicture(FileName, ref LinkToFile, ref SaveWithDocument, ref Anchor); WordDoc.Application.ActiveDocument.InlineShapes[1].Width = 100f;//图片宽度 WordDoc.Application.ActiveDocument.InlineShapes[1].Height = 100f;//图片高度 //将图片设置为四周环绕型 Word.Shape s = WordDoc.Application.ActiveDocument.InlineShapes[1].ConvertToShape(); s.WrapFormat.Type = Word.WdWrapType.wdWrapSquare; newTable.Cell(12, 1).Range.Text = "产品特殊属性"; newTable.Cell(12, 1).Merge(newTable.Cell(12, 3)); //在表格中增加行 WordDoc.Content.Tables[1].Rows.Add(ref Nothing); WordDoc.Paragraphs.Last.Range.Text = "文档创建时间:" + DateTime.Now.ToString();//“落款” WordDoc.Paragraphs.Last.Alignment = 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, ...
大神请教一个问题?ACCESS 中,一个文本框输入数字金额,另一个...
1)为ACCESS数据库新建一个“模块1”(已经有了可以免掉此步),在该模块下编写下列自定义公有大写转换函数Public Function SumInWordsRMB _(SumInFigures As Variant, Optional WithoutHeadRMB As Boolean) As StringDim a As Double, b As ByteDim Str As String, Strg As StringDim strInteger As StringDim strInt As StringDim strDecimalDim strDecmlDim Char As StringDim DigtWord As StringDim Pos As ByteDim i As Byte, Lns As Byte, iiDim canAddZero As BooleanDim AddZero As BooleanDim UseFullDigtWord As BooleanIf Not IsNumeric(SumInFigures) Then SumInWordsRMB = "" Exit FunctionElse a = CDbl(SumInFigures) If a 999999999999999# Then SumInWordsRMB = "" Exit Function End IfEnd IfPos = 0Strg = CStr(SumInFigures)For ii = 1 To Len(Strg) Char = Mid(Strg, ii, 1) If Char = "." Then Pos = ii If IsMissing(Str) Then Str = "0" Exit For End If If Char = "0" Then If AddZero = True Then Str = Str & Char Else Str = Str & Char AddZero = True End IfNext iiIf Pos > 0 And Mid(Strg, Pos + 1, 3) "" Then a = 0 b = 0 If Val(Mid(Strg, Pos + 3, 1)) >= 5 Then b = 1 b = b + Val(Mid(Strg, Pos + 2, 1)) b = 100 + Val(Mid(Strg, Pos + 1, 1)) * 10 + b If b >= 200 Then a = Str a = a + 1 Str = a End If If b 0 Then If Val(Right(b, 1)) > 0 Then Str = Str & "." & Mid(b, 2) Else If Val(Mid(b, 2, 1)) 0 Then Str = Str & "." & Mid(b, 2, 1) End If End IfEnd IfAddZero = FalseIf Str = "0" Or Str = "" Then If WithoutHeadRMB Then SumInWordsRMB = "零元整" Else SumInWordsRMB = "人民币零元整" End If Exit FunctionEnd IfStrg = ""For i = 1 To Len(Str) Select Case Mid(Str, i, 1) Case "0" Strg = Strg & "零" Case "1" Strg = Strg & "壹" Case "2" Strg = Strg & "贰" Case "3" Strg = Strg & "叁" Case "4" Strg = Strg & "肆" Case "5" Strg = Strg & "伍" Case "6" Strg = Strg & "陆" Case "7" Strg = Strg & "柒" Case "8" Strg = Strg & "捌" Case "9" Strg = Strg & "玖" Case "." Strg = Strg & "." End SelectNext iPos = 0Pos = InStr(1, Strg, ".", vbTextCompare)If Pos > 0 Then strInteger = Left(Strg, Pos - 1) strDecimal = Mid(Strg, Pos + 1)Else strInteger = StrgEnd IfIf strInteger = "零" Then strInt = ""Else strInteger = StrReverse(strInteger) Lns = Len(strInteger) For i = 1 To Lns Select Case i Case 1 DigtWord = "元" Case 2 DigtWord = "拾" Case 3 DigtWord = "佰" Case 4 DigtWord = "仟" Case 5 DigtWord = "万" Case 6 DigtWord = "拾万" Case 7 DigtWord = "佰万" Case 8 DigtWord = "仟万" Case 9 DigtWord = "亿" Case 10 DigtWord = "拾亿" Case 11 DigtWord = "佰亿" Case 12 DigtWord = "仟亿" Case 13 DigtWord = "万亿" Case 14 DigtWord = "拾万亿" Case 15 DigtWord = "佰万亿" End Select Char = Mid(strInteger, i, 1) If Char = "零" Then If i = 1 Then strInt = "元" UseFullDigtWord = True If canAddZero = True Then AddZero = True Else If UseFullDigtWord = True Then If AddZero = False Then strInt = Char & DigtWord & strInt Else If i >= 6 And i "零" Then strInt = Char & Left(DigtWord, 1) & "零" & strInt Else strInt = Char & DigtWord & "零" & strInt End If ElseIf i >= 10 And i "零" Then strInt = Char & Left(DigtWord, 1) & "零" & strInt Else strInt = Char & DigtWord & "零" & strInt End If ElseIf i >= 14 And i "零" Then strInt = Char & Left(DigtWord, 1) & "零" & strInt Else strInt = Char & DigtWord & "零" & strInt End If Else strInt = Char & DigtWord & "零" & strInt End If End If Else If AddZero = False Then strInt = Char & Left(DigtWord, 1) & strInt Else strInt = Char & Left(DigtWord, 1) & "零" & strInt End If End If canAddZero = True UseFullDigtWord = False AddZero = False End If Next iEnd IfIf Pos = 0 Then strDecml = "整"If Pos > 0 Then If Len(strDecimal) = 1 Then strDecml = strDecimal & "角整" If Len(strDecimal) = 2 Then If Left(strDecimal, 1) = "零" Then If strInt = "" Then strDecml = Right(strDecimal, 1) & "分" Else strDecml = "零" & Right(strDecimal, 1) & "分" End If Else strDecml = Left(strDecimal, 1) & "角" strDecml = strDecml & Right(strDecimal, 1) & "分" End If End IfEnd IfIf WithoutHeadRMB = False Then strInt = "人民币" & strIntEnd IfSumInWordsRMB = strInt & strDecmlEnd Function2)在ACCESS窗体里使用SumInWordsRMB函数。
每当在文本框TEXT1输入小写金额并回车或跳到其它控件时,文本框TEXT2会显示相应的人民币大写金额。
请于窗体设计窗口,文本框TEXT2内,填入公式"=SumInWordsRMB([TEXT1])" 即可实现。
有关代码中自定义函数的说明...
转载请注明出处51数据库 » select missing word