Главная страница
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.056 c
4-80381
Fast
2003-12-19 16:48
2004.02.25
PaintBox + Printer


3-79562
Alexei
2004-01-29 13:18
2004.02.25
Проблема с передачей данных в хранимую процедуру


3-79583
Vi0let
2004-01-29 03:33
2004.02.25
В гриде с TTable, полоса прокрутки принимает строго 3 положения:


14-80091
Mox Fulder
2004-02-03 15:24
2004.02.25
DivX


14-80222
sucer
2004-01-24 19:09
2004.02.25
---|Ветка была без названия|---