SMExport/SMImport suite

MSWordDocument component: FAQ

Q1 How can I extract a text from doc-file?
Q2 I want to display a Summary Information. How can I do it?
Q3 What is a ConvertSysCharacters property?
Q4 How can I apply the updated version?
Q5 I downloaded a trial package but only first 30Kb of text is extracted from doc-file. I need a full text. What can I do?
Q6 Can I create a doc-file using your component?

 

 

Question:
How can I extract a text from doc-file?

Answer:
TMSWordDocument component have an Execute method. Call this method when you specified a correct document to FileName property.

After that you may read parsed text using PlainText property.

For example, to extract a text from C:\My Documents\Data_2002.doc file and load it in Memo1 component:

procedure TForm1.Button1Click(Sender: TObject);
begin
  MSWordDocument.FileName := 'C:\My Documents\Data_2002.doc';
  MSWordDocument.Execute;
  Memo1.Lines.Assign(MSWordDocument.PlainText);
end;

go top

 

Question:
I want to display a Summary Information. How can I do it?

Answer:
When document is processed (using Execute method), you may read parsed SummaryInformation and process it as you like. For example, to display in ListView1 the Title, Subject and LastSaved properties:

procedure TForm1.Button1Click(Sender: TObject);
begin
  MSWordDocument.FileName := 'C:\My Documents\Data_2002.doc';
  MSWordDocument.Execute;
  with ListView1.Items.Add do
  begin
    Caption := 'Title';
    SubItems.Add(MSWordDocument.SummaryInformation.Title)
  end;
  with ListView1.Items.Add do
  begin
    Caption := 'Subject';
    SubItems.Add(MSWordDocument.SummaryInformation.Subject)
  end;
  with ListView1.Items.Add do
  begin
    Caption := 'Last saved';
    SubItems.Add(DateToStr(MSWordDocument.SummaryInformation.LastSaved))
  end;
end;

go top


Question:
What is a ConvertSysCharacters property?

Answer:
Extracted plain text can contain some system characters. For example, Chr(13) is a new line, Chr(15) is a new page etc

If you'll set ConvertSysCharacters property in True, all such characters will be removed and replaced with correct correspondent character (for example, Chr(13) will be replaced by Chr(13)+Chr(10))

If you don't want such intellectual behaviour for TMSWordDocument, just set ConvertSysCharacters property in False and you'll receive an original text contents

go top


Question:
How can I apply the updated version?

Answer:
You must apply it in two steps:

1. uninstall a previous version

  • run a Delphi IDE
  • select Close All from File menu
  • select Install Packages item from Component menu
  • select a package in listbox which you want to uninstall
  • press Remove button

2. install a new version from sources

  • select Open item from File menu
  • change the FileType to package source (*.dpk/*.bpk)
  • select the package file from folder where you unzipped files
  • in the package window press the Install button
  • after compile in the palette on SMComponents page you can find the components

IMPORTANT:
you must check that folder name with previous version is removed from search path of Delphi/C++Builder IDE and your project. To check it you can in:

  • Tools\Environment Options\Library\Library path
  • Project\Options\Directories and Conditionals\Search path

There you must have a folder with new version but not with previous.

go top


Question:
I downloaded a trial package but only first 30Kb of text is extracted from doc-file. I need a full text. What can I do?

Answer:
This is a limitation of trial package. When you'll order a registered version, you'll recieve another package where any limitations are removed.

Only registered version allow to extract a full text from document

go top


Question:
Can I create a doc-file using your component?

Answer:
Current version of TMSWordDocument component allow to read document only. Now you can't create (or modify) doc-file.

Such feature is in our TO-DO list so in future we'll add such possibility

go top

 

Borland Software Scalabium Delphi tips Scalabium Delphi tips

Copyright© 1998-2024, Scalabium Software. All rights reserved.
webmaster@scalabium.com

January 10, 2005

SMExport advertising