Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2004.02.25;
Скачать: CL | DM;

Вниз

Kак открыть файл XLS RaedOnly? помогите ПЛЗ!   Найти похожие ветки 

 
Бывающий   (2004-01-29 12:15) [0]

Что добавить в нижеследующий код для этого?

str = ExtractFilePath(Application->ExeName) + "Templates\\Bill.xls";

Variant V = CreateOleObject("excel.application");
V.Exec(PropertySet("Visible") << true);
V.Exec(PropertyGet("Workbooks")).Exec(Procedure("Open") << str.c_str());


 
Карелин Артем ©   (2004-01-29 12:30) [1]

VARIANT Open(VARIANT Filename, VARIANT UpdateLinks, VARIANT ReadOnly, VARIANT Format, VARIANT Password, VARIANT WriteResPassword, VARIANT IgnoreReadOnlyRecommended, VARIANT Origin, VARIANT Delimiter, VARIANT Editable, VARIANT Notify, VARIANT Converter );
Соответственно надо в VARIANT ReadOnly передать тру


 
Бывающий   (2004-01-29 12:35) [2]

т.е.

V.Exec(PropertySet("ReadOnly") << true);

?? Не работает, говорит что такого свойства у объекта автоматизации нет.


 
Карелин Артем ©   (2004-01-29 12:40) [3]

Не-не. ReadOnly у нас параметр метода Open, а не свойство Екселя.


 
Бывающий   (2004-01-29 12:53) [4]

Понимаю, но как это сделать грамотно?

str = ExtractFilePath(Application->ExeName) + "Templates\\Bill.xls";

Variant V = CreateOleObject("excel.application");
V.Exec(PropertySet("Visible") << true);
V.Exec(PropertyGet("Workbooks")).Exec(Procedure("Open") << str.c_str() << PropertyGet("ReadOnly") << true);

??

Тоже не работает ...


 
Карелин Артем ©   (2004-01-29 13:01) [5]

Может быть что-то из других параметров надо указать?

ReadOnly Optional Variant. True to open the workbook in read-only mode.

IgnoreReadOnlyRecommended Optional Variant. True to have Microsoft Excel not display the read-only recommended message (if the workbook was saved with the Read-Only Recommended option).

Editable Optional Variant. If the file is a Microsoft Excel 4.0 add-in, this argument is True to open the add-in so that it’s a visible window. If this argument is False or omitted, the add-in is opened as hidden, and it cannot be unhidden. This option doesn"t apply to add-ins created in Microsoft Excel 5.0 or later. If the file is an Excel template, True to open the specified template for editing. False to open a new workbook based on the specified template. The default value is False.

Notify Optional Variant. If the file cannot be opened in read/write mode, this argument is True to add the file to the file notification list. Microsoft Excel will open the file as read-only, poll the file notification list, and then notify the user when the file becomes available. If this argument is False or omitted, no notification is requested, and any attempts to open an unavailable file will fail.


 
Бывающий   (2004-01-29 13:06) [6]

V.Exec(PropertyGet("Workbooks")).Exec(Procedure("Open") << str.c_str() << PropertyGet("ReadOnly") << true);
А синтаксис-то мой корректный?


 
Карелин Артем ©   (2004-01-29 13:15) [7]

Бывающий (29.01.04 13:06) [6]
Не знаю. Мне такой синтаксис незнаком.


 
Бывающий   (2004-01-29 13:33) [8]

Это C++



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

Текущий архив: 2004.02.25;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.031 c
14-80256
REA
2004-02-06 10:40
2004.02.25
Imagebase


14-80284
ИМХО
2004-02-03 20:58
2004.02.25
Кто свершил РЕВОЛЮЦИЮ 1917 года (и что потом поизошло)?


3-79627
3APA3A
2004-01-31 00:10
2004.02.25
Первый символ строки...


9-79531
Norlin
2003-08-06 23:25
2004.02.25
DelphiX и спрайты


1-79795
Raph
2004-02-11 15:23
2004.02.25
Проблемы с массивом!!!