Z
zhouljun
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Menus, ExtCtrls, OleServer, Word2000, OleCtnrs;
type
TForm1 = class(TForm)
PopupMenu1: TPopupMenu;
N111: TMenuItem;
N331: TMenuItem;
N1: TMenuItem;
N2: TMenuItem;
MainMenu1: TMainMenu;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
ListBox1: TListBox;
Button1: TButton;
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
Panel5: TPanel;
WordApplication1: TWordApplication;
WordDocument1: TWordDocument;
procedure N1Click(Sender: TObject);
procedure N331Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N6Click(Sender: TObject);
procedure findfilename(direc,ExName:string;list:tstringlist);
procedure N3Click(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure N8Click(Sender: TObject);
procedure N9Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
uses Unit3,unit4;
{$R *.DFM}
procedure Tform1.findfilename(direc,ExName:string;list:tstringlist);
var
SearchRec: TSearchRec;
retval:integer;
begin
RetVal := FindFirst(direc+'/'+'*.'+exname, faAnyFile, SearchRec);
try
while RetVal = 0 do
begin
if (searchrec.name <> '.') and (searchrec.name<>'..') then
list.add(searchrec.name);
RetVal := FindNext(SearchRec);
end;
finally
FindClose(SearchRec);
end;
end;
procedure TForm1.N1Click(Sender: TObject);
begin
close;
end;
procedure TForm1.N331Click(Sender: TObject);
begin
form3.Show;
end;
procedure TForm1.N5Click(Sender: TObject);
begin
form3.Show;
end;
procedure TForm1.N6Click(Sender: TObject);
begin
close;
end;
procedure TForm1.N3Click(Sender: TObject);
var
direc,exname:string;
fillist:tstringlist;
i:integer;
begin
panel2.Visible:=true;
panel3.Visible:=false;
panel4.Visible:=false;
panel5.Visible:=false;
fillist:=tstringlist.Create;
exname:='doc';
direc:='//Zhouljun/文件发布系统/word/最新文件';
begin
listbox1.Clear;
findfilename(direc,exname,fillist);
for i:=0 to fillist.Count-1 do
begin
listbox1.AddItem(fillist.Strings,nil);
end;
end;
end;
procedure TForm1.N7Click(Sender: TObject);
var
direc,exname:string;
fillist:tstringlist;
i:integer;
begin
panel2.Visible:=false;
panel3.visible:=true;
panel4.Visible:=false;
panel5.Visible:=false;
fillist:=tstringlist.Create;
exname:='doc';
direc:='//Zhouljun/文件发布系统/word/工会文件';
begin
listbox1.Clear;
findfilename(direc,exname,fillist);
for i:=0 to fillist.Count-1 do
begin
listbox1.AddItem(fillist.Strings,nil);
end;
end;
end;
procedure TForm1.N8Click(Sender: TObject);
var
direc,exname:string;
fillist:tstringlist;
i:integer;
begin
panel4.Visible:=true;
panel3.Visible:=false;
panel2.Visible:=false;
panel5.Visible:=false;
fillist:=tstringlist.Create;
exname:='doc';
direc:='//zhouljun/文件发布系统/word/财务文件';
begin
listbox1.Clear;
findfilename(direc,exname,fillist);
for i:=0 to fillist.Count-1 do
begin
listbox1.AddItem(fillist.Strings,nil);
end;
end;
end;
procedure TForm1.N9Click(Sender: TObject);
var
direc,exname:string;
fillist:tstringlist;
i:integer;
begin
panel5.Visible:=true;
panel4.Visible:=false;
panel3.Visible:=false;
panel2.Visible:=false;
fillist:=tstringlist.Create;
exname:='doc';
direc:='//Zhouljun/文件发布系统/word/公司文件';
begin
listbox1.Clear;
findfilename(direc,exname,fillist);
for i:=0 to fillist.Count-1 do
begin
listbox1.AddItem(fillist.Strings,nil);
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
direc,exname:string;
fillist:tstringlist;
i:integer;
SearchRec: TSearchRec;
FileName : OleVariant;
ConfirmConversions : OleVariant;
ReadOnly : OleVariant;
AddToRecentFiles : OleVariant;
PasswordDocument : OleVariant;
PasswordTemplate : OleVariant;
Revert : OleVariant;
WritePasswordDocument : OleVariant;
WritePasswordTemplate : OleVariant;
Format : OleVariant;
Encoding : OleVariant;
Visible : OleVariant;
OpenAndRepair,DocumentDirection,NoEncodeingDialog : OleVariant;
ItemIndex ,Template,NewTemplate,DocuType: OleVariant;
begin
try
wordapplication1.Connect;
except
end;
wordapplication1.Visible:=true;
wordapplication1.Caption:='信息发布中心';
filename:=??????????????????????????????;//如何做?????
ConfirmConversions:=true;
ReadOnly:=true;
AddToRecentFiles:=true;;
PasswordDocument:='';
PasswordTemplate:='';
Revert:=True;
WritePasswordDocument:='';
WritePasswordTemplate:='';
Format:=wdOpenFormatDocument;
Encoding:=false;
Visible:=true;
try
//wordapplication1.Documents.Open(FileName, ConfirmConversions, ReadOnly, AddToRecentFiles,PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Format,Encoding, Visible);
wordapplication1.Documents.Open(FileName,ConfirmConversions,ReadOnly,AddToRecentFiles,PasswordDocument,PasswordTemplate,Revert,WritePasswordDocument,WritePasswordTemplate,Format,Encoding,Visible);
except
showmessage('打开文档失败!');
exit;
end;
end;
end.
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Menus, ExtCtrls, OleServer, Word2000, OleCtnrs;
type
TForm1 = class(TForm)
PopupMenu1: TPopupMenu;
N111: TMenuItem;
N331: TMenuItem;
N1: TMenuItem;
N2: TMenuItem;
MainMenu1: TMainMenu;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
ListBox1: TListBox;
Button1: TButton;
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
Panel5: TPanel;
WordApplication1: TWordApplication;
WordDocument1: TWordDocument;
procedure N1Click(Sender: TObject);
procedure N331Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N6Click(Sender: TObject);
procedure findfilename(direc,ExName:string;list:tstringlist);
procedure N3Click(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure N8Click(Sender: TObject);
procedure N9Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
uses Unit3,unit4;
{$R *.DFM}
procedure Tform1.findfilename(direc,ExName:string;list:tstringlist);
var
SearchRec: TSearchRec;
retval:integer;
begin
RetVal := FindFirst(direc+'/'+'*.'+exname, faAnyFile, SearchRec);
try
while RetVal = 0 do
begin
if (searchrec.name <> '.') and (searchrec.name<>'..') then
list.add(searchrec.name);
RetVal := FindNext(SearchRec);
end;
finally
FindClose(SearchRec);
end;
end;
procedure TForm1.N1Click(Sender: TObject);
begin
close;
end;
procedure TForm1.N331Click(Sender: TObject);
begin
form3.Show;
end;
procedure TForm1.N5Click(Sender: TObject);
begin
form3.Show;
end;
procedure TForm1.N6Click(Sender: TObject);
begin
close;
end;
procedure TForm1.N3Click(Sender: TObject);
var
direc,exname:string;
fillist:tstringlist;
i:integer;
begin
panel2.Visible:=true;
panel3.Visible:=false;
panel4.Visible:=false;
panel5.Visible:=false;
fillist:=tstringlist.Create;
exname:='doc';
direc:='//Zhouljun/文件发布系统/word/最新文件';
begin
listbox1.Clear;
findfilename(direc,exname,fillist);
for i:=0 to fillist.Count-1 do
begin
listbox1.AddItem(fillist.Strings,nil);
end;
end;
end;
procedure TForm1.N7Click(Sender: TObject);
var
direc,exname:string;
fillist:tstringlist;
i:integer;
begin
panel2.Visible:=false;
panel3.visible:=true;
panel4.Visible:=false;
panel5.Visible:=false;
fillist:=tstringlist.Create;
exname:='doc';
direc:='//Zhouljun/文件发布系统/word/工会文件';
begin
listbox1.Clear;
findfilename(direc,exname,fillist);
for i:=0 to fillist.Count-1 do
begin
listbox1.AddItem(fillist.Strings,nil);
end;
end;
end;
procedure TForm1.N8Click(Sender: TObject);
var
direc,exname:string;
fillist:tstringlist;
i:integer;
begin
panel4.Visible:=true;
panel3.Visible:=false;
panel2.Visible:=false;
panel5.Visible:=false;
fillist:=tstringlist.Create;
exname:='doc';
direc:='//zhouljun/文件发布系统/word/财务文件';
begin
listbox1.Clear;
findfilename(direc,exname,fillist);
for i:=0 to fillist.Count-1 do
begin
listbox1.AddItem(fillist.Strings,nil);
end;
end;
end;
procedure TForm1.N9Click(Sender: TObject);
var
direc,exname:string;
fillist:tstringlist;
i:integer;
begin
panel5.Visible:=true;
panel4.Visible:=false;
panel3.Visible:=false;
panel2.Visible:=false;
fillist:=tstringlist.Create;
exname:='doc';
direc:='//Zhouljun/文件发布系统/word/公司文件';
begin
listbox1.Clear;
findfilename(direc,exname,fillist);
for i:=0 to fillist.Count-1 do
begin
listbox1.AddItem(fillist.Strings,nil);
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
direc,exname:string;
fillist:tstringlist;
i:integer;
SearchRec: TSearchRec;
FileName : OleVariant;
ConfirmConversions : OleVariant;
ReadOnly : OleVariant;
AddToRecentFiles : OleVariant;
PasswordDocument : OleVariant;
PasswordTemplate : OleVariant;
Revert : OleVariant;
WritePasswordDocument : OleVariant;
WritePasswordTemplate : OleVariant;
Format : OleVariant;
Encoding : OleVariant;
Visible : OleVariant;
OpenAndRepair,DocumentDirection,NoEncodeingDialog : OleVariant;
ItemIndex ,Template,NewTemplate,DocuType: OleVariant;
begin
try
wordapplication1.Connect;
except
end;
wordapplication1.Visible:=true;
wordapplication1.Caption:='信息发布中心';
filename:=??????????????????????????????;//如何做?????
ConfirmConversions:=true;
ReadOnly:=true;
AddToRecentFiles:=true;;
PasswordDocument:='';
PasswordTemplate:='';
Revert:=True;
WritePasswordDocument:='';
WritePasswordTemplate:='';
Format:=wdOpenFormatDocument;
Encoding:=false;
Visible:=true;
try
//wordapplication1.Documents.Open(FileName, ConfirmConversions, ReadOnly, AddToRecentFiles,PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Format,Encoding, Visible);
wordapplication1.Documents.Open(FileName,ConfirmConversions,ReadOnly,AddToRecentFiles,PasswordDocument,PasswordTemplate,Revert,WritePasswordDocument,WritePasswordTemplate,Format,Encoding,Visible);
except
showmessage('打开文档失败!');
exit;
end;
end;
end.