Skip to Content

시트 편집 AI 종합 실습

실습복습
관련 기초 개념

개요

미리보기·승인·실행·되돌리기를 연결한 시트 편집 경로를 구현한다.

먼저 Office AI 평가·회귀·보안의 핵심 개념을 확인하세요.

핵심 개요

종합 실습에서는 자연어 계획·검증·미리보기·승인·원자 적용·Undo/Redo를 한 경로로 연결합니다. 이 교재의 로컬 예제는 작은 메모리 시트의 명령 계약을 검증하며 실제 Polaris나 Excel 엔진 구현을 대신하지 않습니다.

완료 기준은 값 변경뿐 아니라 잘못된 범위·수식 보호·오래된 revision·중간 실패가 거절되고 되돌리기 가능한 상태가 유지되는 것입니다.

필요한 용어

  • 계약 하네스: 외부 모델·제품 없이 입력과 편집 동작을 검사하는 작은 실행기
  • 스냅샷: 복원에 필요한 특정 시점의 상태 사본

작동 과정

  1. 교육용 셀·수식·revision과 허용 명령을 준비합니다.
  2. 변경 전 전체 검증·미리보기·승인을 적용합니다.
  3. 정상·거절·원자성·Undo/Redo를 자동 검사합니다.

풀이 예제

아래 입력과 기록은 직접 만든 교육용 가상 자료입니다.

입력·조건

셀 A1=2, B1=3이며 C1은 합계 수식입니다. 리터럴 변경 명령으로 A1을 5로 바꾸려 합니다.

판단·결과

A1만 변경하고 수식 셀 C1은 보존합니다. Undo는 원상태, Redo는 적용 상태를 복원해야 합니다.

이렇게 판단한 이유

타입이 있는 편집 명령과 엔진 검증을 통하면 모델 계획의 부작용을 제한할 수 있습니다.

로컬 실행 예제

실행 파일 받기

C++17, g++ -std=c++17 -Wall -Wextra -Werror office_commands.cpp -o office_commands 후 ./office_commands

g++ -std=c++17 -pthread -Wall -Wextra -Werror office_commands.cpp -o office_commands ./office_commands
// C++17 teaching engine: not an Excel/Polaris API and not a distributed OT/CRDT algorithm. #include <cassert> #include <iostream> #include <map> #include <string> #include <vector> struct Cell { int value; bool formula; }; struct Command { std::string address; int value; }; class Sheet { using Cells = std::map<std::string,Cell>; struct History { Cells before, after; }; Cells cells{{"A1",{1,false}},{"A2",{2,false}},{"B1",{3,true}}}; std::vector<History> undo, redo; int historyRevision = 1; public: int revision = 1; int at(const std::string& key) const { return cells.at(key).value; } bool apply(int expected, const std::vector<Command>& commands) { if (expected != revision || commands.empty()) return false; auto after = cells; // Stage every edit before making anything visible. std::map<std::string,bool> seen; for (const auto& command : commands) { auto it = after.find(command.address); if (it == after.end() || it->second.formula || seen[command.address]) return false; seen[command.address] = true; it->second.value = command.value; } // The host must serialize this entire method on its document thread. if (historyRevision != revision) undo.clear(); undo.push_back({cells,after}); redo.clear(); cells = after; historyRevision = ++revision; return true; } bool undoOnce() { if (undo.empty() || revision != historyRevision) return false; auto h = undo.back(); undo.pop_back(); cells = h.before; redo.push_back(h); historyRevision = ++revision; return true; } bool redoOnce() { if (redo.empty() || revision != historyRevision) return false; auto h = redo.back(); redo.pop_back(); cells = h.after; undo.push_back(h); historyRevision = ++revision; return true; } void remoteEdit(const std::string& key, int value) { cells.at(key).value = value; ++revision; // Conservative policy: invalidate local history rather than erase another editor's work. undo.clear(); redo.clear(); historyRevision = revision; } }; int main() { Sheet sheet; assert(!sheet.apply(1, {{"A1",10},{"A2",20},{"B1",30}})); assert(sheet.at("A1")==1 && sheet.at("A2")==2 && sheet.revision==1); assert(!sheet.undoOnce()); // Failed transaction creates no history. assert(!sheet.apply(1, {{"A1",10},{"A1",20}})); assert(!sheet.apply(1, {{"Z99",10}})); assert(sheet.apply(1, {{"A1",10},{"A2",20}})); assert(!sheet.apply(1, {{"A1",90}})); // Stale proposal. assert(sheet.undoOnce() && sheet.at("A1")==1 && sheet.at("A2")==2); assert(sheet.redoOnce() && sheet.at("A1")==10 && sheet.at("A2")==20); sheet.remoteEdit("A1",99); assert(!sheet.undoOnce() && sheet.at("A1")==99); std::cout << "PASS: atomic failure, formula/range/duplicate guards, revision, Undo/Redo, remote edit\n"; }

기대 결과: 원자 실패·수식/범위/중복 보호·revision·Undo/Redo·원격 편집 검사

2026-10-21 로컬 환경에서 실행했습니다. 가상 자료·소형 CPU 예제의 동작 검사이며 실제 업무 모델의 품질·클라우드·GPU·Office 제품 연동 검증은 아닙니다.

흔한 실패와 복구

예제의 메모리 복사를 실제 엔진의 모든 객체 수명·공동편집 충돌 정책으로 일반화하지 않습니다. 실제 계약을 확인해야 합니다.

확인 문제

종합 실습에서 모의 하네스 통과는 무엇을 뜻하나요?

  1. 실제 Office 파일 호환 검증이 끝났다
  2. 모든 공동편집 상황이 보장된다
  3. 작성한 작은 명령 계약을 검사했으며 실제 제품 통합은 별도다

풀이 기록 기능을 불러오는 중…

해설 보기

정답: C. 작성한 작은 명령 계약을 검사했으며 실제 제품 통합은 별도다

작성한 작은 명령 계약을 검사했으며 실제 제품 통합은 별도다 예제의 메모리 복사를 실제 엔진의 모든 객체 수명·공동편집 충돌 정책으로 일반화하지 않습니다. 실제 계약을 확인해야 합니다.

참고 자료

  1. Microsoft: Excel JavaScript application-specific APIs  — 셀·범위·배치 실행의 공개 제품 사례.
  2. Anthropic: Agent evaluations  — 과제·시도·실행 결과·평가자 검증.
  3. Python: json  — JSON의 직렬화·파싱과 자료형.

자료 확인: 2026-10-21. 사례·문항·실습은 자체 제작했습니다. 외부 서비스 호출과 실제 모델 품질 측정은 학습자가 별도 환경에서 수행합니다.

직접 적용하기

교육용 가상 상황

로컬 하네스를 확장해 범위 밖 명령·수식 덮어쓰기·오래된 revision·복합 명령 실패를 시험하고 실제 엔진 연결 지점을 설명하세요.

미리보기·승인·실행·되돌리기를 연결한 시트 편집 경로를 구현한다. 판단 근거와 검증할 결과를 적으세요.

답안 저장 기능을 불러오는 중…

검증 기준과 해설 보기
  1. 정상·세 가지 거절·원자성을 검사한다
  2. Undo·Redo 상태를 비교한다
  3. 모의 하네스와 실제 제품 검증을 구분한다

모든 명령을 검사한 뒤 스냅샷을 보존하고 적용합니다. 범위 밖·수식 대상·revision 불일치 중 하나면 전체를 거절합니다. Undo/Redo는 값·수식 상태를 비교하며 실제 엔진에서는 기존 명령·알림·재계산·협업·직렬화 경로에 어댑터를 연결해 같은 과제를 다시 검증합니다.

복습하기

  1. 종합 경로는 어떻게 이어지나요?
  2. 실패 명령은 언제 찾나요?
  3. 실제 엔진에 추가할 검사는?
답변 확인 기준
  1. 종합 경로는 어떻게 이어지나요?

    계획→검증→미리보기→승인→적용→복원 검사입니다.

  2. 실패 명령은 언제 찾나요?

    실제 적용 전에 전체 사전검사를 수행합니다.

  3. 실제 엔진에 추가할 검사는?

    명령·알림·재계산·협업·저장·객체 수명 계약 검사입니다.