Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > DB-Aware

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 02-14-2001, 02:13 AM
YED YED is offline
Junior Member
 
Join Date: Feb 2001
Posts: 28
Default 2 question (word and dbgird)

1-)how I can insert new page in word document from delphi
2-)my database field longer then 255 character but dbgird show only first 255 character. why? and how I can show all characters?

I am sory for my bad English...
Reply With Quote
  #2  
Old 02-14-2001, 02:03 PM
Claude Claude is offline
Senior Member
 
Join Date: Jan 2001
Posts: 178
Default RE: 2 question (word and dbgird)

Your question contains two unrelated topics!

Regarding adding a page to Word, Delphi Servers components will expose the Word Object model; you have to master this model. Hundreds of objects are available and these objects often have dozens of properties/methods. The following example uses the TypeText method to alter a document. It types "Hello" at the current cursor location and then inserts a page break.

var
FileName : OleVariant;
WordApplication : TWordApplication;
begin
FileName := 'c:\test.doc';
WordApplication := TWordApplication.Create(self);
WordApplication.Connect;
WordApplication.Documents.Open(Filename, EmptyParam,
EmptyParam, EmptyParam, EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam, EmptyParam);
WordApplication.ActiveDocument.ActiveWindow.
Selection.TypeText('Hello' + #12);
WordApplication.ActiveDocument.Save;
WordApplication.Disconnect;
WordApplication.Free;
end;

As you may notice, the TypeText applies to the selection object, which is a property of the ActiveWindow Object. To insert text as a specific location, you will have to navigate thru the document. I can only recommand that you read a good book about the Word Object Model (I personnaly use "Writing Word Macros" published at O'Reilly).

Regarding the second question, It is the first time I hear about a database having strings longer that 255 characters. Usually, longer strings are put in Memo fields. What database are you using? Are you sure your field is really longer than 255 characters? If so, maybe delphi truncates the string and you should consider a DbGrid replacement that supports "Memo" cells (I use DevExpress's Quantum Grid and I am very satisfied).
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:43 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.