Excel Script
Excel Script 이벤트는 함수기반으로 엑셀을 컨트롤 할 수 있습니다.
1. Excel Script 이벤트의 Main Context에서 ExcelControlClass 클래스 목록을 보면 함수 종류와 사용법에 대하여 알 수 있습니다.
2. Event Properties
- Event Name : 이벤트 이름
- Stop If Error : 에러 발생 시 중지 여부
3. ExcelControlClass 클래스 목록
public string ToColumnAddress(int colIndex)
- 열 번호를 열 문자로 변경
public int ToColumnIndex(string columnLetter)
- 열 문자를 열 번호로 변경
public string SetExcelID
- Excel ID 설정 (get, set)
public int SetWorkbookID
- Workbook ID 설정 (get, set)
public bool ExcelAppExecute(string ExcelID, bool bVisible = true)
- 엑셀 프로그램 실행
public bool ExcelAppTerminate(string ExcelID, bool bNoMessage = true)
- 엑셀 프로그램 종료
public int ExcelFileOpen(string ExcelID, string strExcelFilePath)
- 엑셀 파일 열기
public bool ExcelFileSave(string ExcelID, int nWorkbookID, string strExcelFilePath)
- 엑셀 파일 저장
public bool ExcelWorkbookClose(string ExcelID, int nWorkbookID, bool bNoMessage = true)
- 엑셀 Workbook 닫기
public int AddSheet(string strSheetName = "")
- 시트 생성
public int AddSheet(string ExcelID, int nWorkbookID, string strSheetName = "")
-
public List<string> GetSheetList()
- 시트 목록
public List<string> GetSheetList(string ExcelID, int nWorkbookID)
-
public bool MoveSheet(int nSheetSrcIndex, int nSheetDestIndex)
- 시트 위치 이동 (대상 시트 번호, 이동 할 시트 번호)
public bool MoveSheet(
string ExcelID,
int nWorkbookID,
int nSheetSrcIndex,
int nSheetDestIndex)
-
public bool RenameSheet(int nSheetSrcIndex, string strSheetName)
- 시트명 변경 (대상 시트 번호, 변경할 시트명)
public bool RenameSheet(
string ExcelID,
int nWorkbookID,
int nSheetSrcIndex,
string strSheetName)
-
public bool ActiveSheet(int nSheetSrcIndex)
- 시트 선택 (시트 번호)
public bool ActiveSheet(string ExcelID, int nWorkbookID, int nSheetSrcIndex)
-
public bool DeleteSheet(int nSheetSrcIndex)
- 시트 삭제 (시트 번호)
public bool DeleteSheet(string ExcelID, int nWorkbookID, int nSheetSrcIndex)
-
public int GetLastRowIndex()
- 마지막 행 번호
public int GetLastRowIndex(string ExcelID, int nWorkbookID)
-
public int GetLastColumnIndex()
- 마지막 열 번호
public int GetLastColumnIndex(string ExcelID, int nWorkbookID)
-
public string GetSelectedRange()
- 선택된 범위 셀 값 가져오기
public string GetSelectedRange(string ExcelID, int nWorkbookID)
-
public bool SelectRange(int nColumnST, int nRowST, int nColumnED, int nRowED)
- 셀 범위 선택 (열 시작 번호, 행 시작 번호, 열 마지막 번호, 행 마지막 번호)
public bool SelectRange(
string ExcelID,
int nWorkbookID,
int nColumnST,
int nRowST,
int nColumnED,
int nRowED)
-
public bool SelectRange(string strRange)
- 셀 범위 선택 (범위 셀 문자) : 예) A1:D10
public bool SelectRange(string ExcelID, int nWorkbookID, string strRange)
-
public bool SelectRange(string strRangeST, string strRangeED)
- 셀 범위 선택 (시작 셀명, 마지막 셀명)
public bool SelectRange(string ExcelID, int nWorkbookID, string strRangeST, string strRangeED)
-
public bool SelectColumn(int nColumnIndex)
- 열 선택 (열 번호)
public bool SelectColumn(string strTargetColumnAddress)
- 열 선택 (열명)
public bool SelectColumn(string ExcelID, int nWorkbookID, int nColumnIndex)
-
public bool SelectColumn(string ExcelID, int nWorkbookID, string strTargetColumnAddress)
-
public bool SelectColumns(params string[] ColumnAddress)
- 다중 열 선택 (열명 배열) : 예) ["A","C",F"]
public bool SelectColumns(string ExcelID, int nWorkbookID, params string[] ColumnAddress)
-
public bool SelectRows(params int[] TargetRowIndex)
- 다중 행 선택 (행 번호 배열) : 예) [1, 5, 7]
public bool SelectRows(string ExcelID, int nWorkbookID, params int[] TargetRowIndex)
-
public bool SelectAll(bool bDataOnly)
- 셀 모두 선택 (데이터 영역 여부)
public bool SelectAll(string ExcelID, int nWorkbookID, bool bDataOnly)
-
public List<string> FindSelectedRange(string strFindText, bool bFullMatch, bool bMatchCase)
- 선택된 범위에서 찾기 (찾을 문자, 전체 매칭 여부, 매칭 케이스)
public List<string> FindSelectedRange(
string ExcelID,
int nWorkbookID,
string strFindText,
bool bFullMatch,
bool bMatchCase)
-
public bool SelectCell(int nColumn, int nRow)
- 셀 선택 (열 번호, 행 번호)
public bool SelectCell(string ExcelID, int nWorkbookID, int nColumn, int nRow)
-
public bool SelectCell(string strCellAddress)
- 셀 선택 (셀명)
public bool SelectCell(string ExcelID, int nWorkbookID, string strCellAddress)
-
public bool Merge()
- 병합
public bool Merge(string ExcelID, int nWorkbookID)
public bool UnMerge()
- 병합 해제
public bool UnMerge(string ExcelID, int nWorkbookID)
-
public bool HiddenRows(params int[] TargetRowIndex)
- 다중 행 숨기기 (행 번호 배열)
public bool HiddenRows(string ExcelID, int nWorkbookID, params int[] TargetRowIndex)
-
public bool UnHiddenRows(params int[] TargetRowIndex)
- 다중 행 숨기기 해제 (행 번호 배열)
public bool UnHiddenRows(string ExcelID, int nWorkbookID, params int[] TargetRowIndex)
-
public bool HiddenColumns(params string[] ColumnAddress)
- 다중 열 숨기기 (열명 배열)
public bool HiddenColumns(string ExcelID, int nWorkbookID, params string[] ColumnAddress)
-
public bool UnHiddenColumns(params string[] ColumnAddress)
- 다중 열 숨기기 해제 (열명 배열)
public bool UnHiddenColumns(string ExcelID, int nWorkbookID, params string[] ColumnAddress)
-
public bool DeleteEmptyColumns()
- 비어 있는 열 삭제
public bool DeleteEmptyColumns(string ExcelID, int nWorkbookID)
-
public bool DeleteEmptyRows()
- 비어 있는 행 삭제
public bool DeleteEmptyRows(string ExcelID, int nWorkbookID)
-
public bool DeleteColumn(string strColumnAddress)
- 열 삭제 (열명)
public bool DeleteColumn(string ExcelID, int nWorkbookID, string strColumnAddress)
-
public bool DeleteCells(SHIFT_DELETE_DIRECTION ShiftDirection)
- 셀 삭제 (밀기 옵션) : 예) SHIFT_DELETE_DIRECTION.LEFT (왼쪽 밀기) / SHIFT_DELETE_DIRECTION.UP (위로 밀기) / SHIFT_DELETE_DIRECTION.VALUE (값만 삭제)
public bool DeleteCells(string ExcelID, int nWorkbookID, SHIFT_DELETE_DIRECTION ShiftDirection)
-
public bool DeleteRow(int nRowIndex)
- 행 삭제 (행 번호)
public bool DeleteRow(string ExcelID, int nWorkbookID, int nRowIndex)
-
public bool ClearColumn(string strColumnAddress)
- 열 지우기 (열명)
public bool ClearColumn(string ExcelID, int nWorkbookID, string strColumnAddress)
-
public bool ClearRow(int nRowIndex)
- 행 지우기 (행 번호)
public bool ClearRow(string ExcelID, int nWorkbookID, int nRowIndex)
-
public bool CopyToClipboard()
- 클립보드로 복사
public bool CopyToClipboard(string ExcelID, int nWorkbookID)
-
public bool CutToClipboard()
- 클립보드로 잘라내기
public bool CutToClipboard(string ExcelID, int nWorkbookID)
-
public bool PasteAsClipboard(bool bDataOnly)
- 클립보드에서 붙여넣기 (값만 붙여넣기 여부)
public bool PasteAsClipboard(string ExcelID, int nWorkbookID, bool bDataOnly)
-
public bool InsertAsClipboard(SHIFT_INSERT_DIRECTION ShiftDirection)
- 클립보드에서 추가 (밀기 옵션) : 예) SHIFT_INSERT_DIRECTION.DOWN (아래 밀기) / SHIFT_DELETE_DIRECTION.RIGHT (오른쪽 밀기)
public bool InsertAsClipboard(
string ExcelID,
int nWorkbookID,
SHIFT_INSERT_DIRECTION ShiftDirection)
-
public bool PasteFormats()
- 수식 붙여넣기
public bool PasteFormats(string ExcelID, int nWorkbookID)
-
public bool PasteFormulas()
- 서식 붙여넣기
public bool PasteFormulas(string ExcelID, int nWorkbookID)
-
public DataTable ClipboardToDataTable()
- 클립보드 값을 DataTable로 저장
public bool PasteAsDataTable(DataTable dt)
- DataTable에서 붙여넣기 (DataTable 변수명)
public bool PasteAsDataTable(string ExcelID, int nWorkbookID, DataTable dt)
-
public bool InsertAsDataTable(DataTable dt, SHIFT_INSERT_DIRECTION ShiftDirection)
- DataTable에서 추가 (밀기 옵션) : 예) SHIFT_INSERT_DIRECTION.DOWN (아래 밀기) / SHIFT_DELETE_DIRECTION.RIGHT (오른쪽 밀기)
public bool InsertAsDataTable(
string ExcelID,
int nWorkbookID,
DataTable dt,
SHIFT_INSERT_DIRECTION ShiftDirection)
-
public bool InsertBlankRow()
- 빈 행 추가
public bool InsertBlankRow(string ExcelID, int nWorkbookID)
-
public bool InsertBlankColumn()
- 빈 열 추가
public bool InsertBlankColumn(string ExcelID, int nWorkbookID)
-
public string GetOneCellValue()
- 셀 값 가져오기
public string GetOneCellValue(string strCellAddress)
- 셀 값 가져오기 (셀명)
public string GetOneCellValue(int nColumn, int nRow);
- 셀 값 가져오기 (열 번호, 행 번호)
public string GetOneCellValue(string ExcelID, int nWorkbookID, string strCellAddress)
-
public string GetOneCellValue(string ExcelID, int nWorkbookID, int nColumn, int nRow)
-
public string GetOneCellValue(string ExcelID, int nWorkbookID)
-
public string GetRangeCellValue()
- 범위 셀 값 가져오기
public string GetRangeCellValue(string ExcelID, int nWorkbookID)
-
public bool SetOneCellValue(string strValue)
- 셀 값 입력하기 (입력 문자)
public bool SetOneCellValue(int nColumn, int nRow, string strValue)
- 셀 값 입력하기 (열 번호, 행 번호, 입력 문자)
public bool SetOneCellValue(string strCellAddress, string strValue)
- 셀 값 입력하기 (셀명, 입력 문자)
public bool SetOneCellValue(
string ExcelID,
int nWorkbookID,
int nColumn,
int nRow,
string strValue)
-
public bool SetOneCellValue(
string ExcelID,
int nWorkbookID,
string strCellAddress,
string strValue)
-
public bool SetOneCellValue(string ExcelID, int nWorkbookID, string strValue)
-
public List<string> GetColumnDistinctList(int nColumnIndex)
- 열 고유 목록 가져오기 (열 번호)
public List<string> GetColumnDistinctList(string strTargetColumnAddress)
- 열 고유 목록 가져오기 (열 명)
public List<string> GetColumnDistinctList(
string ExcelID,
int nWorkbookID,
int nColumnIndex)
-
public List<string> GetColumnDistinctList(
string ExcelID,
int nWorkbookID,
string strTargetColumnAddress)
-
public string FindEndCell(FIND_DIRECTION FindDirection)
-
public string FindEndCell(string ExcelID, int nWorkbookID, FIND_DIRECTION FindDirection)
-
public bool SetAutoFilter_DataFiltering(int nFilterColumnNumber, List<string> lstFilterData)
-
public bool SetAutoFilter_DataFiltering(
string strTargetColumnAddress,
List<string> lstFilterData)
-
public bool SetAutoFilter_DataFiltering(
string ExcelID,
int nWorkbookID,
string strTargetColumnAddress,
List<string> lstFilterData)
-
public bool SetAutoFilter_DataFiltering(
string ExcelID,
int nWorkbookID,
int nFilterColumnNumber,
List<string> lstFilterData)
-
public bool SetAutoFilter_NumberFiltering(
int nFilterColumnNumber,
string strFilter1,
FILTER_OPERATOR FilterOperator,
string strFilter2 = "")
-
public bool SetAutoFilter_NumberFiltering(
string strTargetColumnAddress,
string strFilter1,
FILTER_OPERATOR FilterOperator,
string strFilter2 = "")
-
public bool SetAutoFilter_NumberFiltering(
string ExcelID,
int nWorkbookID,
string strTargetColumnAddress,
string strFilter1,
FILTER_OPERATOR FilterOperator = FILTER_OPERATOR.ONE_FILTER,
string strFilter2 = "")
-
public bool SetAutoFilter_NumberFiltering(
string ExcelID,
int nWorkbookID,
int nFilterColumnNumber,
string strFilter1,
FILTER_OPERATOR FilterOperator = FILTER_OPERATOR.ONE_FILTER,
string strFilter2 = "")
-
public bool SetAutoFilter_TopFiltering(
int nFilterColumnNumber,
FILTER_TOP FilterTop,
FILTER_TOPITEMS FilterItems,
int nTopValue)
-
public bool SetAutoFilter_TopFiltering(
string strTargetColumnAddress,
FILTER_TOP FilterTop,
FILTER_TOPITEMS FilterItems,
int nTopValue)
-
public bool SetAutoFilter_TopFiltering(
string ExcelID,
int nWorkbookID,
string strTargetColumnAddress,
FILTER_TOP FilterTop,
FILTER_TOPITEMS FilterItems,
int nTopValue)
-
public bool SetAutoFilter_TopFiltering(
string ExcelID,
int nWorkbookID,
int nFilterColumnNumber,
FILTER_TOP FilterTop,
FILTER_TOPITEMS FilterItems,
int nTopValue)
-
public bool UnSetAutoFilter()
- 필터 해제
public bool UnSetAutoFilter(string ExcelID, int nWorkbookID)
-
public bool SendKeys(string strKeyCommand, bool bWait = true)
- 키 입력 (매크로 키, 대기 여부)
public bool SendKeys(string ExcelID, int nWorkbookID, string strKeyCommand, bool bWait = true)
-
public bool SortColumns(
bool bIsFirstColumnHeader,
int nSelectedColumnNumber1,
SORT_ORDER SortOrder1,
SORT_DATAOPTION SortDataOption1,
int nSelectedColumnNumber2 = 0,
SORT_ORDER SortOrder2 = SORT_ORDER.ASCENDING,
SORT_DATAOPTION SortDataOption2 = SORT_DATAOPTION.SORT_NORMAL,
int nSelectedColumnNumber3 = 0,
SORT_ORDER SortOrder3 = SORT_ORDER.ASCENDING,
SORT_DATAOPTION SortDataOption3 = SORT_DATAOPTION.SORT_NORMAL)
-
public bool SortColumns(
string ExcelID,
int nWorkbookID,
bool bIsFirstColumnHeader,
int nSelectedColumnNumber1,
SORT_ORDER SortOrder1,
SORT_DATAOPTION SortDataOption1,
int nSelectedColumnNumber2 = 0,
SORT_ORDER SortOrder2 = SORT_ORDER.ASCENDING,
SORT_DATAOPTION SortDataOption2 = SORT_DATAOPTION.SORT_NORMAL,
int nSelectedColumnNumber3 = 0,
SORT_ORDER SortOrder3 = SORT_ORDER.ASCENDING,
SORT_DATAOPTION SortDataOption3 = SORT_DATAOPTION.SORT_NORMAL)
-
public object MacroRun(string strMacro, params object[] Args)
- 엑셀 매크로 실행
public object MacroRun(string ExcelID, int nWorkbookID, string strMacro, params object[] Args)
-
Created with the Personal Edition of HelpNDoc: Easily create Web Help sites