Document Editing
Document Editing includes overall document editing operations such as real-time input and modification, range selection, copy and paste, cell merging and splitting.
| Function | API | Description | Example |
|---|---|---|---|
| Real-time Data Input/Modification | Range.Value2 | Property that returns or changes data in the specified range |
let range = instance.Application.ActiveSheet.UsedRange;
console.log(range.Value2); range.Value2 = "test"; |
| Range.Value | Function that returns data in the specified range |
let range = instance.Application.ActiveSheet.UsedRange;
console.log(range.Value()); | |
| Range.SetValue | Function that changes data in the specified range |
let range = instance.Application.ActiveSheet.UsedRange;
range.SetValue(null, "test"); | |
| Cell Selection and Range Specification | Range.Select | Function that processes the specified range as selected |
let range = instance.Application.ActiveSheet.UsedRange;
range.Select(); |
| Worksheet.Range | Function that specifies a specific range in the specified sheet |
let sheet = instance.Application.ActiveSheet;
let cell = sheet.Range("A1"); let range = sheet.Range("A1:B2"); | |
| Range Copy/Paste/Cut | Range.Copy | Function that copies data in the specified range only to the engine internally |
let range = instance.Application.ActiveSheet.UsedRange;
range.Copy(); |
| Range.CopyToClipboard | Function that copies data in the specified range to both the engine internally and clipboard |
let range = instance.Application.ActiveSheet.UsedRange;
await range.CopyToClipboard(); | |
| Range.PasteSpecial | Function that pastes data copied to the engine internally to the specified range |
let range = instance.Application.ActiveSheet.Range("A1");
range.PasteSpecial(); | |
| Range.PasteFromClipboard | Function that pastes data from the clipboard to the specified range |
let range = instance.Application.ActiveSheet.Range("A1");
await range.PasteFromClipboard(); | |
| Range.Cut |
Function that copies data in the specified range only to the engine internally and sets it to cut waiting state
cf) Existing data is removed after calling Range.PasteSpecial and Range.PasteFromClipboard functions |
let range = instance.Application.ActiveSheet.UsedRange;
range.Cut(); // Data is maintained as it's in cut waiting state let target = instance.Application.ActiveSheet.Range("A1"); target.PasteSpecial(); // Data is pasted to this range and data from the cut range is removed | |
| Range.CutToClipboard |
Function that copies data in the specified range to both the engine internally and clipboard and sets it to cut waiting state
cf 1) Existing data is removed after calling Range.PasteSpecial and Range.PasteFromClipboard functions cf 2) Asynchronous (async) function |
let range = instance.Application.ActiveSheet.UsedRange;
await range.CutToClipboard(); // Data is maintained as it's in cut waiting state let target = instance.Application.ActiveSheet.Range("A1"); await target.PasteFromClipboard(); // Data is pasted to this range and data from the cut range is removed | |
|
Shape Copy/Cut
cf) Shape paste operations use Range.PasteSpecial and Range.PasteFromClipboard functions | Shape.Copy | Function that copies the selected shape only to the engine internally |
let shape = instance.Application.ActiveSheet.Shapes.Item(1);
shape.Copy(); |
| Shape.CopyToClipboard |
Function that copies the selected shape to both the engine internally and clipboard
cf) Asynchronous (async) function |
let shape = instance.Application.ActiveSheet.Shapes.Item(1);
await shape.CopyToClipboard(); | |
| Shape.Cut |
Function that copies the selected shape only to the engine internally and sets it to cut waiting state
cf) Existing data is removed after calling Range.PasteSpecial and Range.PasteFromClipboard functions |
let shape = instance.Application.ActiveSheet.Shapes.Item(1);
shape.Cut(); // Shape is maintained as it's in cut waiting state let target = instance.Application.ActiveSheet.Range("A1"); target.PasteSpecial(); // Shape is pasted to this range and the cut shape is removed | |
| Shape.CutToClipboard |
Function that copies the selected shape to both the engine internally and clipboard and sets it to cut waiting state
cf 1) Existing data is removed after calling Range.PasteSpecial and Range.PasteFromClipboard functions cf 2) Asynchronous (async) function |
let shape = instance.Application.ActiveSheet.Shapes.Item(1);
await shape.CutToClipboard(); // Shape is maintained as it's in cut waiting state let target = instance.Application.ActiveSheet.Range("A1"); await target.PasteFromClipboard(); // Shape is pasted to this range and the cut shape is removed | |
|
Chart Copy
cf) Chart paste operations use Range.PasteSpecial and Range.PasteFromClipboard functions | ChartObject.Copy | Function that copies the selected chart only to the engine internally |
let chartObject = instance.Application.ActiveSheet.ChartObjects(1);
chartObject.Copy(); |
| ChartObject.CopyToClipboard | Function that copies the selected chart to both the engine internally and clipboard cf) Asynchronous (async) function |
let chartObject = instance.Application.ActiveSheet.ChartObjects(1);
await chartObject.CopyToClipboard(); | |
| Cell Merge/Split | Range.Merge | Function that merges the specified range |
let range = instance.Application.ActiveSheet.UsedRange;
range.Merge(); |
| Range.UnMerge | Function that unmerges the merged range |
let range = instance.Application.ActiveSheet.Range("A1");
range.UnMerge(); | |
| Range.MergeArea | Property that returns the entire merged range object if the specified range is merged (for single cells only) |
let range = instance.Application.ActiveSheet.Range("A1:C3");
range.Merge(); let a1c3Range = instance.Application.ActiveSheet.Range("B2").MergeArea; let d1Cell = instance.Application.ActiveSheet.Range("D1").MergeArea; | |
| Range.MergeCells | Property that returns whether the specified range is merged or performs merging |
let range = instance.Application.ActiveSheet.Range("A1:C3");
console.log(range.MergeCells); range.MergeCells = true; |