Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Начинающим";
Текущий архив: 2007.09.09;
Скачать: [xml.tar.bz2];

Вниз

Как открыть файл .doc, на который установлен пароль?   Найти похожие ветки 

 
Alex_AA ©   (2007-08-20 05:56) [0]

Здравствуйте! Подскажите, пожалуйста, как из Delphi загрузить MS Word и открыть файл, на который установлен пароль. Спасибо.


 
Alex_AA ©   (2007-08-20 06:23) [1]

Пароль известен!


 
Думкин ©   (2007-08-20 06:29) [2]

Open Method
               

Syntax 1: Opens the specified document and adds it to the Documents collection. Returns a Document object.

Syntax 2: Opens the specified object. When applied to a Subdocument or RecentFile object, Syntax 2 returns a Document object.

Syntax 1

expression.Open(FileName, ConfirmConversions, ReadOnly, AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Format, Encoding, Visible)

Syntax 2

expression.Open

expression   Syntax 1: Required. An expression that returns a Documents object.

Syntax 2: Required. An expression that returns an OLEFormat, RecentFile, Subdocument, or Version object.

FileName   Required Variant. The name of the document (paths are accepted).

ConfirmConversions   Optional Variant. True to display the Convert File dialog box if the file isn"t in Microsoft Word format.

ReadOnly   Optional Variant. True to open the document as read-only.

AddToRecentFiles   Optional Variant. True to add the file name to the list of recently used files at the bottom of the File menu.

PasswordDocument   Optional Variant. The password for opening the document.

PasswordTemplate   Optional Variant. The password for opening the template.

Revert   Optional Variant. Controls what happens if Name is the file name of an open document. True to discard any unsaved changes to the open document and reopen the file. False to activate the open document.

WritePasswordDocument   Optional Variant. The password for saving changes to the document.

WritePasswordTemplate   Optional Variant. The password for saving changes to the template.

Format   Optional Variant. The file converter to be used to open the document. Can be one of the following WdOpenFormat constants: wdOpenFormatAllWord, wdOpenFormatAuto, wdOpenFormatDocument, wdOpenFormatEncodedText, wdOpenFormatRTF, wdOpenFormatTemplate, wdOpenFormatText, wdOpenFormatUnicodeText, or wdOpenFormatWebPages. The default value is wdOpenFormatAuto.

To specify an external file format, apply the OpenFormat property to a FileConverter object to determine the value to use with this argument.

Encoding   Optional Variant. The document encoding (code page or character set) to be used by Microsoft Word when you view the saved document. Can be any valid MsoEncoding constant. For the list of valid MsoEncoding constants, see the Object Browser in the Visual Basic Editor. The default is the system code page. Read/write Long.

Visible   Optional Variant. True if the document is opened in a visible window. The default is True.


 
Alex_AA ©   (2007-08-20 08:59) [3]

Приведите, пожалуйста, пример. Не могу разобраться. Какие-то ошибки лезут. Может модуль надо еще какой-то подключить.


 
Elen ©   (2007-08-20 09:32) [4]


>  Какие-то ошибки лезут

Какие?


 
Alex_AA ©   (2007-08-20 10:05) [5]

uses ComObj;

procedure TForm1.Button1Click(Sender: TObject);
var
 WRDAPP, WordDocument1:Variant;
{Expression.Open(FileName, ConfirmConversions, ReadOnly, AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Format, Encoding, Visible)}
begin
WRDAPP:= CreateOleObject("Word.Application");
WordDocument1 := WRDAPP.Documents.Open("Primer.doc",false);
//что здесь надо написать, чтобы файл, защищенный паролем открылся?
end;


 
umbra ©   (2007-08-20 10:19) [6]


> WordDocument1 := WRDAPP.Documents.Open("Primer.doc",false);

WordDocument1 := WRDAPP.Documents.Open(Filename:="Primer.doc", PasswordDocument:="123");


 
Alex_AA ©   (2007-08-20 11:28) [7]

Спасибо, мастера!!!



Страницы: 1 вся ветка

Форум: "Начинающим";
Текущий архив: 2007.09.09;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.46 MB
Время: 0.043 c
15-1185869028
Alex Konshin
2007-07-31 12:03
2007.09.09
Анализатор трейс файлов Оракл.


15-1186987362
WondeRu at work
2007-08-13 10:42
2007.09.09
Поверхность из стерео-изображений


2-1187184153
harisma
2007-08-15 17:22
2007.09.09
Работа с реестром


3-1179212185
zdm
2007-05-15 10:56
2007.09.09
Миграция


15-1186900481
Тимоха
2007-08-12 10:34
2007.09.09
Что за ошибка такая





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский