请问如何象WORD一样画表格和在表内填文字,并能保存和调用。(能否留个QQ交流一个)
解决方案 »
- LoginPrompt 属性?
- 我要使用LeftStr等函数 所以在uses中增加了StrUtils 为什么还是报错啊?我把USES和出错贴了出来,请大家帮我看下,谢谢。
- 通过ADOQUERY 查询完毕了,想取出某一个字段的值怎么弄?
- [请教]如何在ListView控件的某列中嵌入Button,并实现button点击事件
- 作毕设时遇到一个问题,我想选中dbgrid中的某一行,然后以这一行中某一字段作条件去查询数据库中相应的记录,请问怎么编?
- 100分求一个简单SQL语句。主要是 where 后面的条件。帮顶者有分。最迟本周末结贴。
- 提一个从收款到打印发票的问题
- 程序主窗口采用web方式,想点击连接的时候打开程序中的某个窗口
- 在dephli下如何制作一个非windows标准滚动条控件
- 一个无关痛痒的问题!
- SQL如何访问,不在SERVER系统下.
- 求教:本人想用delphi实现并口通讯
procedure TForm1.BitBtn1Click(Sender: TObject);
var
NewTable,myRange,Word, Doc:OleVariant; //, Fields
i:integer;
Align,ShowFirst:olevariant;
begin
try
Word:=CreateOleObject('Word.Application');
except
application.MessageBox('Çë°²×°Microsoft Word 2000 »ò¸ü¸ß°æ±¾£¡','¾¯¸æ£¡',mb_ok+mb_iconwarning);
abort;
end;
Word.Visible:=True;
//´´½¨¿ÕÎĵµ£»
Word.Documents.Add();
//½«Ò³Ãæ¸ÄΪ¡°ºáÏò¡±£»
Word.ActiveDocument.PageSetup.Orientation := wdOrientLandscape;
Word.ActiveDocument.PageSetup.LineNumbering.Active:=False;
Word.ActiveDocument.PageSetup.Orientation := wdOrientLandscape; Word.ActiveDocument.PageSetup.TopMargin := 2/0.035;
Word.ActiveDocument.PageSetup.BottomMargin := 2/0.035;
Word.ActiveDocument.PageSetup.LeftMargin := 2/0.035;
Word.ActiveDocument.PageSetup.RightMargin := 2/0.035;
Word.ActiveDocument.PageSetup.Gutter := 0;
Word.ActiveDocument.PageSetup.HeaderDistance := 1.2/0.035;
Word.ActiveDocument.PageSetup.FooterDistance := 1.5/0.035;
Word.ActiveDocument.PageSetup.PageWidth := 29.7/0.035;
Word.ActiveDocument.PageSetup.PageHeight := 21/0.035; Word.ActiveDocument.PageSetup.FirstPageTray := wdPrinterDefaultBin;
Word.ActiveDocument.PageSetup.OtherPagesTray := wdPrinterDefaultBin;
Word.ActiveDocument.PageSetup.SectionStart := wdSectionNewPage;
Word.ActiveDocument.PageSetup.OddAndEvenPagesHeaderFooter := False;
Word.ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter := False;
Word.ActiveDocument.PageSetup.VerticalAlignment := wdAlignVerticalTop;
Word.ActiveDocument.PageSetup.SuppressEndnotes := False;
Word.ActiveDocument.PageSetup.MirrorMargins := False;
Word.ActiveDocument.PageSetup.TwoPagesOnOne := False;
Word.ActiveDocument.PageSetup.GutterPos := wdGutterPosLeft;
Word.ActiveDocument.PageSetup.LayoutMode := wdLayoutModeLineGrid; Doc := Word.ActiveDocument;
//дÈëҳüҳ½Å
//дÈëҳüҳ½Å
If word.ActiveWindow.View.SplitSpecial <> wdPaneNone Then
begin
word.ActiveWindow.Panes(2).Close;
End;
If (word.ActiveWindow.ActivePane.View.Type=wdNormalView)
Or (word.ActiveWindow.ActivePane.View.Type=wdOutlineView) Then
begin
word.ActiveWindow.ActivePane.View.Type:=wdPrintView;
End;
word.ActiveWindow.ActivePane.View.SeekView := wdSeekCurrentPageHeader;
Word.Selection.Font.NameFarEast:='ËÎÌå';
Word.Selection.Font.NameAscii:='Times New Roman';
Word.Selection.Font.NameOther:='Times New Roman';
Word.Selection.Font.Name:='Times New Roman';
Word.Selection.Font.Size:=9;
Word.Selection.Font.Bold:=false;
Word.Selection.Font.Italic:=wdToggle;
Word.Selection.TypeText(Text:='<< Ç¿ÄÔ¹¤³ÌÒµÎñѵÁ·ÏµÍ³ >>');
word.Application.Selection.ParagraphFormat.Alignment := wdAlignParagraphRight; Align:=wdAlignPageNumberCenter;
ShowFirst:=True;
Word.ActiveDocument.Sections.Item(1).Footers.Item(1).PageNumbers.Add(Align,ShowFirst); Word.ActiveWindow.ActivePane.View.SeekView := wdSeekMainDocument; //дÈë±êÌ⣻
Word.Selection.ParagraphFormat.Alignment:=wdAlignParagraphCenter;
Word.Selection.Font.NameFarEast:='ËÎÌå';
Word.Selection.Font.NameAscii:='Times New Roman';
Word.Selection.Font.NameOther:='Times New Roman';
Word.Selection.Font.Name:='Times New Roman';
Word.Selection.Font.Size:=22;
Word.Selection.Font.Bold := true;
Word.Selection.TypeText(Text:='ѵÁ·¼Æ»®'); Word.Selection.TypeParagraph;
Word.Selection.ParagraphFormat.Alignment:= wdAlignParagraphJustify;
Word.Selection.Font.NameFarEast:='ËÎÌå';
Word.Selection.Font.NameAscii:='Times New Roman';
Word.Selection.Font.NameOther:='Times New Roman';
Word.Selection.Font.Name:='Times New Roman';
Word.Selection.Font.Size:=9;
Word.Selection.Font.Bold := false;
//Word.Selection.Font.Bold:=wdToggle;
Word.Selection.TypeParagraph;
//»­³ö¿Õ±í¸ñ£»
Word.ActiveDocument.Tables.Add(Range:=Word.Selection.Range,
NumRows:=10, //ClientDataSet_tmp.RecordCount+1,
NumColumns:=10,
DefaultTableBehavior:=0,
AutoFitBehavior:=0);
//ºÏ²¢±í¸ñ
word.Selection.MoveDown(wdLine,1,wdExtend);
word.Selection.Cells.Merge; word.Selection.MoveRight(1,1,wdMove);
word.Selection.MoveRight(1,5,wdExtend);
word.Selection.Cells.Merge; word.Selection.MoveRight(2,1,wdMove);
word.Selection.MoveDown(wdLine,1,wdExtend);
word.Selection.Cells.Merge;
word.Selection.MoveRight(3,1,wdMove);
word.Selection.MoveDown(wdLine,1,wdExtend);
word.Selection.Cells.Merge;
word.Selection.MoveRight(3,1,wdMove);
word.Selection.MoveDown(wdLine,1,wdExtend);
word.Selection.Cells.Merge;
word.Selection.MoveRight(3,1,wdMove);
word.Selection.MoveDown(wdLine,1,wdExtend);
word.Selection.Cells.Merge;
end;