Arsip: Export to Ms.Word

more 13 years ago
bboyz
Hi, master-master semua, saya baru gabung disini nih...Saya da kesulitan dengan mengeksport teks ke Ms.Word...Thanx Be4 :lol:

more 13 years ago
bagussb
ini saya punya class nya... tapi dulu ga tau dapet dari mana... lupa lagie... :)
unit unWinWord;
interface
uses
Word2000, Windows, SysUtils, Variants;
type
TWinWord = class
private
App : _Application;
function fGetVisible : boolean;
procedure fSetVisible(visible : boolean);
public
procedure NewDoc(Template : String);
procedure GotoBookmark(Bookmark : String);
procedure InsertText(Text : String);
procedure MoveRight(Count : integer);
procedure Print;
procedure UpdateFields;
procedure SaveAs(Filename : string);
Procedure RunMacro(MacroName : string);
constructor Create;
destructor Destroy; override;
property visible : boolean read fGetVisible write fSetVisible;
end;
implementation
constructor TWinWord.Create;
begin
App := CoWordApplication.Create;
end;
destructor TWinWord.Destroy;
var
SaveChanges : OLEVariant;
OriginalFormat : OLEVariant;
RouteDocument : OLEVariant;
begin
SaveChanges := wdDoNotSaveChanges;
OriginalFormat := unAssigned;
RouteDocument := unAssigned;
app.Quit(SaveChanges, OriginalFormat, RouteDocument);
inherited destroy;
end;
function TWinWord.fGetVisible : boolean;
begin
result := App.Visible;
end;
procedure TWinWord.fSetVisible(Visible : boolean);
begin
App.visible := Visible;
end;
procedure TWinWord.GotoBookmark(Bookmark : string);
var
What : OLEVariant;
Which : OLEVariant;
Count : OLEVariant;
Name : OLEVariant;
begin
What := wdGoToBookmark;
Which := unAssigned;
Count := unAssigned;
Name := Bookmark;
App.Selection.GoTo_(What, Which, Count, Name);
end;
procedure TWinWord.InsertText(Text : String);
begin
App.Selection.TypeText(Text);
end;
procedure TWinWord.NewDoc(Template : String);
var
DocTemplate : OleVariant;
NewTemplate : OleVariant;
begin
DocTemplate := Template;
NewTemplate := False;
App.Documents.AddOld(DocTemplate, NewTemplate);
end;
procedure TWinWord.MoveRight(Count : integer);
var
MoveUnit : OleVariant;
vCount : OleVariant;
Extended : OleVariant;
begin
MoveUnit := wdCell;
vCount := Count;
Extended := unassigned;
app.selection.MoveRight(MoveUnit, vCount, Extended);
end;
procedure TWinWord.Print;
begin
OLEVariant(app).Printout;
end;
procedure TWinWord.UpdateFields;
begin
App.ActiveDocument.Fields.Update;
end;
procedure TWinWord.SaveAs(Filename : string);
begin
OLEVariant(App).ActiveDocument.SaveAs(FileName);
end;
procedure TWinWord.RunMacro(MacroName : string);
begin
App.RunOld(MacroName);
end;
end.

more 13 years ago
bboyz
Saya pake komponen "WordApplication1" en "WordDocument1", truz saya pake procedure "WordDocument1.Range.Select" utk mem-blok kalimat-kalimatnya utk diatur font size en font bold-nya, tp smua kalimat ikut ke-blok jadi semua kalimatnya mengikuti pengaturan font size en font bold yang paling akhir..tolong dibantu ya...thanx

more 13 years ago
bboyz
oh iya mas, "procedure TWinWord.MoveRight(Count : integer);" tuh utk format tabel ya ?

more 13 years ago
bboyz
sory mas di bawah ini potongan coding yg saya pake, tapi msh acak2an coz masih dicoba2..Klo ga keberatan tolong dicek, saya belum bisa memisahkan kalimat-kalimat yang di-blok...
WA.Visible:=true;
WA.Caption:='Ngetest';
WD.Range.Select;
WD.Range.Text:='Ngetest';
WD.Range.Font.Size:=18;
WD.Range.Font.Bold:=1;
WD.Range.Select;
WD.Range.InsertAfter(#13+'Ini aplikasi utk uji coba');
WD.Range.Font.Size:=10;
WD.Range.Font.Bold:=0;
WD.Disconnect;
WA.Disconnect;
Ket : WA => WordApplication1
WD => WordDocument1

more 13 years ago
bagussb
kalo ngga salah untuk range, ada overloadnya.
dicoba begini bisa ngga yah :
a := 1;
b := 10;
with WD.Range(a,b).Font do
begin
Bold := 1;
Size := 18;
end;
dimana a dan b itu OleVariant, trus nilainya nunjukin
posisi karakternya...

more 13 years ago
bboyz
Mas, Sory neh kayaknya dah basi tapi thanx bgt dah bantu mecahin problem saya...skali lagi hatur nuhun...

more 13 years ago
BoedaxBanten
Saya mau Nyetak Laporan Ke Ms.Word XP atau Word 2000, gimana caranya,makasih
more ...
- Pages:
- 1
reply |
Report Obsolete
Last Articles
- Project Group dalam Lazarus
- FastPlaz Database Explorer
- Release: FastPlaz Super Mom v0.12.22
- PascalClass #3: Web Development with Free Pascal
- Makna Pascal di Pascal Indonesia
- Kulgram : Instalasi Lazarus di Perangkat Berbasis ARM
- PascalClass #1: Analisa Database dan Machine Learning
- PascalTalk #6: (Podcast) Kuliah IT di luar negeri, susah gak sih?
- Mengenal OXYGENE – Pascal For .NET
- PascalTalk #5: UX: Research, Design and Engineer
Last Topic
- PascalTalk #6: (Podcast) Kuliah IT di luar negeri, susah gak sih?
by LuriDarmawan in Tutorial & Community Project more 3 months ago - PascalTalk #5: UX: Research, Design and Engineer
by LuriDarmawan in Tutorial & Community Project more 3 months ago - PascalTalk #4: Obrolan Ringan Seputar IT
by LuriDarmawan in Tutorial & Community Project more 4 months ago - PascalTalk #2: Membuat Sendiri SMART HOME
by LuriDarmawan in Tutorial & Community Project more 4 months ago - PascalTalk #3: RADically Fast and Easy Mobile Apps Development with Delphi
by LuriDarmawan in Tutorial & Community Project more 4 months ago - PascalTalk #1: Pemanfaatan Artificial Intelligence di Masa Covid-19
by LuriDarmawan in Tutorial & Community Project more 4 months ago - Tempat Latihan Posting
by LuriDarmawan in OOT more 1 years ago - Archive
- Looping lagi...
by idhiel in Hal umum tentang Pascal Indonesia more 8 years ago - [ask] koneksi ke ODBC user Dsn saat runtime dengan ado
by halimanh in FireBird more 8 years ago - Validasi menggunakan data tanggal
by mas_kofa in Hal umum tentang Pascal Indonesia more 8 years ago
Random Topic
- Mask / DisplayFormat pada QuickReport
by bad2001 in Reporting more 12 years ago - tentang validasi nich ? please !
by jajang in Tip n Trik Pemrograman more 12 years ago - Hapus record dalam dua table yang berlainan sekaligus
by hafiezd in Tip n Trik Pemrograman more 11 years ago - Windows API
by Chep_Rytheone in Hal umum tentang Pascal Indonesia more 15 years ago - Upgred YIntai biar bisa log in lagi
by mandoh in Network, Files, I/O & System more 11 years ago - Pengumuman . . (Billing)
by tox2wow in OOT more 12 years ago - intraweb di apache 2
by herux in onLinux more 13 years ago - Nanya : Bikin Avatar Kumahanya ???
by tox2wow in OOT more 15 years ago - Cara mengakses table paradox berpassword..??
by pribadi in Paradox more 15 years ago - MySQL Connection Through Windows 7
by ax3l in MySQL more 10 years ago