|
![]() |
#1 |
Участник
|
Не нашел оригинальный пост, с которого я содрал код, поэтому просто приведу метод, который использую я у себя:
X++: void protectWorkBook(boolean _displayGridLines = true, boolean _protect = true, str _password = date2str(SystemDateGet(), 123, 2, 0, 2, 0, 4) + time2str(timeNow(), 0, 0)) { COM comWorkBook; COM comWorkSheets; COM comWorkSheet; COM comActiveWindow; int iCount, workSheetCount; int applVersion; ; if (prmIsDefault(_protect) && !this.doProtectWorkBook()) return; if (!_protect) return; try { applVersion = str2int(m_comApplication.version()); comWorkBook = m_comApplication.activeWorkBook(); comWorkSheets = comWorkBook.workSheets(); workSheetCount = comWorkSheets.count(); for (iCount = 1; iCount <= workSheetCount; iCount++) { comWorkSheet = comWorkSheets.Item(iCount); if (applVersion >= 10) { comWorkSheet.protect( _password, //password true, //DrawingObjects true, //Contents true, //Scenarios true, //UserInterfaceOnly true, //AllowFormattingCells true, //AllowFormattingColumns true, //AllowFormattingRows false, //AllowInsertingColumns false, //AllowInsertingRows false, //AllowInsertingHyperlinks false, //AllowDeletingColumns false, //AllowDeletingRows true, //AllowSorting true, //AllowFiltering true //AllowUsingPivotTables ); } else { comWorkSheet.protect( _password, //password true, //DrawingObjects true, //Contents true, //Scenarios true //UserInterfaceOnly ); } comWorkSheet.enableSelection(-4142); //xlNoSelection } comActiveWindow = m_comApplication.activeWindow(); comActiveWindow.displayGridLines(_displayGridLines); } catch { this.throwError(@"Произошла ошибка при блокировании редактирования рабочей книги Excel"); } } У диалога есть методы filenameLookupFilter и другие. Используются вот так: X++: _filenameLookupFilter = conIns(_filenameLookupFilter,1,"@SYS76040", '*.axc'); X++: _filenameLookupFilter = ['All files','*.*']; |
|
|
За это сообщение автора поблагодарили: Sergey Petrov (1), xfree (1). |
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|