아웃라인
윤곽 특징, 또한 그룹화 또는 차원 개요, 그룹 행 또는 컬할 수 있는 그룹으로 작업표에 있는 란이라고, 큰 datasets를 편성하고 요약하게 쉬운 합니다.
소개
Univer 시트에서 개요 기능은 다음과 같은 작업을 지원합니다.
- 그룹 행 또는 열: 데이터를 구성하기 위해 행 또는 열의 계층을 구축하십시오.
- 붕괴 및 확장 그룹: 한 번의 클릭으로 행 또는 열의 그룹을 표시하거나 숨깁니다.
- 그룹 별: 데이터가 더 깊은 계층을 가지고 있을 때 그룹의 여러 레벨을 만듭니다.
아웃라인 그룹은 일반적으로 다음과 같은 상황에서 사용합니다.
- 상세한 데이터를 요약: 요약 줄 아래 그룹 상세 행을 요약하여 더 명확하게 볼 수 있습니다.
- 큰 데이터셋 구성: 관련 열을 유지하거나 탐색을 쉽게 할 수 있도록 행합니다.
- 콜apsible 보고서 작성: 사용자가 필요에 따라 보고서의 섹션을 확장하거나 축소하십시오.
플러그인 모드
설치
pnpm add @univerjs-pro/sheets-outline @univerjs-pro/sheets-outline-uinpm install @univerjs-pro/sheets-outline @univerjs-pro/sheets-outline-uiyarn add @univerjs-pro/sheets-outline @univerjs-pro/sheets-outline-uibun add @univerjs-pro/sheets-outline @univerjs-pro/sheets-outline-ui사용법
import { UniverSheetsOutlinePlugin } from '@univerjs-pro/sheets-outline'import { UniverSheetsOutlineUIPlugin } from '@univerjs-pro/sheets-outline-ui'import SheetsOutlineUIEnUS from '@univerjs-pro/sheets-outline-ui/locale/en-US'import { LocaleType, mergeLocales, Univer } from '@univerjs/core'import '@univerjs-pro/sheets-outline/facade'import '@univerjs-pro/sheets-outline-ui/lib/index.css'const univer = new Univer({ locale: LocaleType.EN_US, locales: { [LocaleType.EN_US]: mergeLocales( SheetsOutlineUIEnUS, ), },})univer.registerPlugin(UniverSheetsOutlinePlugin)univer.registerPlugin(UniverSheetsOutlineUIPlugin)Univer에 대한 상용 라이센스가 있는 경우 Client의 라이센스 사용에서 설명된대로 구성합니다.
모바일 지원
모바일 편집기를 먼저 구성하십시오. 이 페이지의 플러그인 모드 설정에서, 같은 패키지에서 모바일 내보내기 아래 데스크탑 등록을 대체, 문서 열기. 모델 플러그인 유지, 스타일, 로컬, 그리고 Facade 수입, 그리고 두 변종을 등록하지 마십시오.
| 패키지 | 데스크톱 등록 | 모바일 등록 |
|---|---|---|
@univerjs-pro/sheets-outline-ui | UniverSheetsOutlineUIPlugin | UniverSheetsOutlineMobileUIPlugin |
프리셋 모드
아웃라인 기능은 @univerjs/preset-sheets-advanced 프리셋에 포함되어 있습니다.
설치
pnpm add @univerjs/preset-sheets-advancednpm install @univerjs/preset-sheets-advancedyarn add @univerjs/preset-sheets-advancedbun add @univerjs/preset-sheets-advanced사용법
import { UniverSheetsAdvancedPreset } from '@univerjs/preset-sheets-advanced'import UniverPresetSheetsAdvancedEnUS from '@univerjs/preset-sheets-advanced/locales/en-US'import { UniverSheetsCorePreset } from '@univerjs/preset-sheets-core'import UniverPresetSheetsCoreEnUS from '@univerjs/preset-sheets-core/locales/en-US'import { createUniver, LocaleType, mergeLocales } from '@univerjs/presets'import '@univerjs/preset-sheets-core/lib/index.css'import '@univerjs/preset-sheets-advanced/lib/index.css'const { univerAPI } = createUniver({ locale: LocaleType.EN_US, locales: { [LocaleType.EN_US]: mergeLocales( UniverPresetSheetsCoreEnUS, UniverPresetSheetsAdvancedEnUS, ), }, presets: [ UniverSheetsCorePreset(), UniverSheetsAdvancedPreset(), ],})Univer에 대한 상용 라이센스가 있는 경우 Client의 라이센스 사용에서 설명된대로 구성합니다.
Facade API
전체 Facade API 유형 정의는 FacadeAPI에 있습니다.
가져오기
플러그인 모드 참고
Facade 패키지는 플러그인 모드에서 수동으로 가져올 수 있습니다. 미리 설정 모드는 이미 해당 Facade 포장을 포함하므로 추가 수입이 필요하지 않습니다.
import '@univerjs-pro/sheets-outline/facade'행 아웃라인 만들기
Facade API로 행아웃 그룹 만들기:
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getActiveSheet()// Group rows 2 to 6 (0-based index: startRow=1, numRows=5)fWorksheet.addRowOutline(1, 5)열 아웃라인 만들기
열 윤곽은 동일한 방법으로 창조됩니다:
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getActiveSheet()// Group columns B to E (0-based index: startColumn=1, numColumns=4)fWorksheet.addColumnOutline(1, 4)아웃라인 접기 및 펼치기
그룹은 또한 붕괴되거나 확장 된 프로그래밍 할 수 있습니다.
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getActiveSheet()const rowOutlines = fWorksheet.getDimensionOutlines(univerAPI.Enum.DimensionOutlineAxis.ROW)if (rowOutlines.length > 0) { // Collapse the first row outline group fWorksheet.setDimensionOutlineCollapsed(rowOutlines[0].id, true) // Expand it later fWorksheet.setDimensionOutlineCollapsed(rowOutlines[0].id, false)}아웃라인 삭제하기
ID로 단일 개요 그룹 제거:
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getActiveSheet()const rowOutlines = fWorksheet.getDimensionOutlines(univerAPI.Enum.DimensionOutlineAxis.ROW)if (rowOutlines.length > 0) { fWorksheet.removeDimensionOutline(rowOutlines[0].id)}범위 내 아웃라인 지우기
범위 내의 모든 개요 그룹을 지우십시오 :
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getActiveSheet()// Remove all row outline groups fully contained in rows 2 to 10fWorksheet.clearDimensionOutlines(univerAPI.Enum.DimensionOutlineAxis.ROW, 1, 9)아웃라인 조회하기
worksheet에 존재하는 개요 그룹을 읽으십시오:
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getActiveSheet()// Get all row outlinesconst rowOutlines = fWorksheet.getDimensionOutlines(univerAPI.Enum.DimensionOutlineAxis.ROW)rowOutlines.forEach((outline) => { console.log(outline.id, outline.start, outline.end, outline.collapsed)})// Get all outlines (both row and column)const allOutlines = fWorksheet.getDimensionOutlines()아웃라인 데이터 구조
개요 그룹에는 다음과 같은 속성이 있습니다.
| 속성 | 타입 | 설명 |
|---|---|---|
id | string | 아웃라인 그룹의 고유 식별자 |
unitId | string | 워크북 단위 ID |
subUnitId | string | 워크시트 시트 ID |
axis | DimensionOutlineAxis | 아웃라인의 축(row 또는 column) |
start | number | 0부터 시작하는 범위의 시작 인덱스(포함) |
end | number | 0부터 시작하는 범위의 끝 인덱스(포함) |
collapsed | boolean | 그룹이 현재 접혀 있는지 여부 |
유효성 검사 및 오류
개요 그룹 만들기는 다음과 같은 체크를 수행합니다.
- 잘못된 범위: 범위는 유효해야, non-negative 의미와 비-zero 조사.
- 의 경계: 범위는 워크 시트 경계 내에서 남아 있어야 합니다.
- 크로스 그룹: 새로운 그룹은 기존 그룹을 교차할 수 없습니다.
- 최대 깊이: 개요 그룹은 최대 배열 깊이가 있습니다.
ungrouping에 통과된 범위는 완전하게 outline 그룹의 범위를 포함합니다; 그렇지 않으면 체크는 실패합니다.
체크가 실패하면 명령이 실행되지 않으며 오류가 SheetsOutlineErrorService를 통해 방출됩니다.
이 가이드는 어떠셨나요?