Главная страница
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.044 c
1-79802
groff
2004-02-11 15:10
2004.02.25
Сканирование дериктории


14-80093
Sergey_Masloff
2004-01-30 23:01
2004.02.25
Женщины-программисты


1-79908
AlexandrKu
2004-02-09 16:14
2004.02.25
Доступ к ячейкам Excel через OleContainer


1-79989
HF-Trade
2004-02-14 10:52
2004.02.25
Как сохраниться в определенную строку.


4-80379
deema
2003-12-14 19:20
2004.02.25
Как определить ширину текста в пункте меню?