Главная страница
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.021 c
3-79554
rosl
2004-02-02 05:43
2004.02.25
помогите с запросом


14-80108
BlackLord2003
2004-01-20 19:20
2004.02.25
Office 2003


14-80126
syte_ser78
2004-02-02 17:34
2004.02.25
Помогите написать функцию


4-80346
BKGG
2003-12-17 20:06
2004.02.25
Как с помощю API создать обработчик нажатия Button-а.


14-80100
Layner
2004-02-05 14:52
2004.02.25
Выводил ли кто нибудь WMZ (WebMoney) в наличку?