有谁对WORD处理软件中表格功能的实现有了解? 具体讲就是如何实现表格的调整,合并,撤分等功能 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 具体对表格的操作可以通过录制宏获得!{打开Word文档,初始化信息}function TcommonFunc.CreateTestPaper(wordFile: String):OLEVariant;var MSWord: OLEVariant; i:Integer;begin//打开Word; try MSWord := GetActiveOleObject('Word.Application'); except try MSWord := CreateOleObject('Word.Application'); except Exit; end; end; MSWord.Visible := True; //----新建word----// //MSWord.Documents.Add(NewTemplate:=true); //----打开word----// MSWord.documents.open(FileName:=wordFile); //写入标题; with adotest_mess do begin sql.Clear; sql.add('select * from test_message where id='+inttostr(pmainformtp.test_id)); open; MSWord.Selection.ParagraphFormat.Alignment:=wdAlignParagraphCenter; MSWord.Selection.Font.Size:=22; MSWord.Selection.Font.Bold:=wdToggle; MSWord.Selection.TypeText(Text:=FieldByName('test_name').asstring); MSWord.Selection.TypeParagraph; MSWord.Selection.Font.Bold:=wdToggle; MSWord.Selection.ParagraphFormat.Alignment:= wdAlignParagraphCenter; MSWord.Selection.Font.Size:=11; MSWord.Selection.TypeParagraph; //创建表格 MSWord.ActiveDocument.Tables.Add(Range:=MSWord.Selection.Range, NumRows:=2, NumColumns:=13, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=wdAutoFitContent); MSWord.Selection.Tables.item(1).Select; MSWord.Selection.ParagraphFormat.Alignment := wdAlignParagraphCenter; //向表格写入数据 MSWord.Selection.TypeText(Text:='题号'); MSWord.Selection.MoveDown(Unit:=wdLine, Count:=1); MSWord.Selection.TypeText(Text:='分数'); MSWord.Selection.MoveUp(Unit:=wdLine, Count:=1); for i:=1 to 10 do begin MSWord.Selection.MoveRight(Unit:=wdCharacter, Count:=1); MSWord.Selection.TypeText(Text:=self.numToCnStrNum(i)); end; MSWord.Selection.MoveRight(Unit:=wdCharacter, Count:=1); MSWord.Selection.TypeText(Text:='总分'); MSWord.Selection.MoveRight(Unit:=wdCharacter, Count:=1); MSWord.Selection.TypeText(Text:='附加题'); MSWord.Selection.MoveDown(Unit:=wdLine, Count:=1); MSWord.Selection.MoveDown(Unit:=wdLine, Count:=1); result:=MSWord end;end; 关于跨服务器的数据库连接 请问像 office 2003 那样的工具栏大家是怎样做出来的呀 Delphi可否做出比较完善的图文混排? 能Hook掉一个程序里的类吗? DLL问题 ADOQuery中如何进行回退? 注册表又一难题?给分100。 关于Form生成过程中触发事件的问题? 近期开发过程中遇到的一些不常见问题的解决方法(更新中) 谁来讲讲Web Server Application中三个选项ISAPI,CGI,WIN CGI三者的区别! 在美国,在5分钟内能回答出这道题的人,平均年薪在20万美金 请问各位大侠,在哪儿有关于DBChart的介绍?或者,有没有更好的控件,可以实现图形显示?
function TcommonFunc.CreateTestPaper(wordFile: String):OLEVariant;
var
MSWord: OLEVariant;
i:Integer;
begin
//打开Word;
try
MSWord := GetActiveOleObject('Word.Application');
except
try
MSWord := CreateOleObject('Word.Application');
except
Exit;
end;
end;
MSWord.Visible := True;
//----新建word----//
//MSWord.Documents.Add(NewTemplate:=true); //----打开word----//
MSWord.documents.open(FileName:=wordFile);
//写入标题;
with adotest_mess do
begin
sql.Clear;
sql.add('select * from test_message where id='+inttostr(pmainformtp.test_id));
open;
MSWord.Selection.ParagraphFormat.Alignment:=wdAlignParagraphCenter;
MSWord.Selection.Font.Size:=22;
MSWord.Selection.Font.Bold:=wdToggle;
MSWord.Selection.TypeText(Text:=FieldByName('test_name').asstring);
MSWord.Selection.TypeParagraph;
MSWord.Selection.Font.Bold:=wdToggle; MSWord.Selection.ParagraphFormat.Alignment:= wdAlignParagraphCenter;
MSWord.Selection.Font.Size:=11;
MSWord.Selection.TypeParagraph;
//创建表格
MSWord.ActiveDocument.Tables.Add(Range:=MSWord.Selection.Range,
NumRows:=2,
NumColumns:=13,
DefaultTableBehavior:=wdWord9TableBehavior,
AutoFitBehavior:=wdAutoFitContent);
MSWord.Selection.Tables.item(1).Select;
MSWord.Selection.ParagraphFormat.Alignment := wdAlignParagraphCenter;
//向表格写入数据
MSWord.Selection.TypeText(Text:='题号');
MSWord.Selection.MoveDown(Unit:=wdLine, Count:=1);
MSWord.Selection.TypeText(Text:='分数');
MSWord.Selection.MoveUp(Unit:=wdLine, Count:=1);
for i:=1 to 10 do
begin
MSWord.Selection.MoveRight(Unit:=wdCharacter, Count:=1);
MSWord.Selection.TypeText(Text:=self.numToCnStrNum(i));
end;
MSWord.Selection.MoveRight(Unit:=wdCharacter, Count:=1);
MSWord.Selection.TypeText(Text:='总分');
MSWord.Selection.MoveRight(Unit:=wdCharacter, Count:=1);
MSWord.Selection.TypeText(Text:='附加题');
MSWord.Selection.MoveDown(Unit:=wdLine, Count:=1);
MSWord.Selection.MoveDown(Unit:=wdLine, Count:=1);
result:=MSWord
end;
end;