Camera Shape

The Camera shape provides a live snapshot, or mirror image, of a referenced range area in the spreadsheet. It is a dynamic image, meaning that any change in the referenced region is immediately reflected in the camera shape image making them ideal for creating informative dashboards.

Camera shapes can be moved, resized, rotated and supported for Excel I/O. They can also be grouped or ungrouped with other shapes and copy pasted from one sheet to another.

Description
app.component.ts
index.html
app.component.html
styles.css
Copy to CodeMine

SpreadJS provides camera shape.

You can add a camera shape and change the camera shape style using the CameraShape API

    var shape = sheet.shapes.addCameraShape("myCameraShape1", "CameraShape!A1:D7", 240, 200);
    var shapeStyle = shape.style();
    shapeStyle.fill.color = 'pink';
    shapeStyle.fill.transparency = 0.5;
    shapeStyle.line.color = 'green';
    shapeStyle.line.lineStyle = GC.Spread.Sheets.Shapes.PresetLineDashStyle.dashDot;
    shapeStyle.line.width = 5;
    shapeStyle.line.capType = GC.Spread.Sheets.Shapes.LineCapStyle.square;
    shapeStyle.line.joinType = GC.Spread.Sheets.Shapes.LineJoinStyle.miter;
    shapeStyle.line.transparency = 0.5;
    shape.style(shapeStyle);
SpreadJS provides camera shape. You can add a camera shape and change the camera shape style using the CameraShape API
import { Component, NgModule, enableProdMode } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { SpreadSheetsModule } from '@mescius/spread-sheets-angular'; import GC from '@mescius/spread-sheets'; import "@mescius/spread-sheets-shapes"; import './styles.css'; @Component({ selector: 'app-component', templateUrl: 'src/app.component.html' }) export class AppComponent { hostStyle = { width: '100%', height: '100%', overflow: 'hidden', float: 'left' }; constructor() { } initSpread($event: any) { let spread = $event.spread; let sheet = spread.getSheet(0); spread.suspendPaint(); prepareCellRangeData(sheet); initShape(sheet); spread.resumePaint(); } } function prepareCellRangeData(sheet: GC.Spread.Sheets.Worksheet){ sheet.setArray(0, 0, [ ["Product", "Price", "Quantity", "Sales"], ['Kraft Real Mayo', 5.71, 1], ['Smartfood Popcorn', 2.5, 4], ['Teddy Grahams Crackers', 35, 5], ['Parmesan Cheese', 14.89, 9], ['Planter Deluxe Whole Cashew', 8.52, 3], ['Total'] ]); sheet.setColumnWidth(0, 190); sheet.setColumnWidth(1, 100); sheet.setColumnWidth(2, 100); sheet.setColumnWidth(3, 100); sheet.setFormula(1, 3, "B2*C2"); sheet.setFormula(2, 3, "B3*C3"); sheet.setFormula(3, 3, "B4*C4"); sheet.setFormula(4, 3, "B5*C5"); sheet.setFormula(5, 3, "B6*C6"); sheet.addCustomName('customName1', '=$B$2:$B$6', 0, 0); sheet.addCustomName('customName2', '=$C$2:$C$6', 0, 0); sheet.setFormula(6, 1, "=SUM(customName1)"); sheet.setFormula(6, 2, "=SUM(customName2)"); sheet.getRange(6, 0, 1, 4).foreColor('red'); sheet.setFormula(6, 3, "B7*C7"); sheet.getRange(-1,1,0,1).formatter("$ #,##0.00"); sheet.getRange(-1,3,0,1).formatter("$ #,##0.00"); var table = sheet.tables.add("table1", 0, 0, 7, 4, GC.Spread.Sheets.Tables.TableThemes.light7); table.filterButtonVisible(false); } function initShape(sheet: GC.Spread.Sheets.Worksheet) { var shape = sheet.shapes.addCameraShape("myCameraShape1", "CameraShape!A1:D7", 240, 200); var shapeStyle = shape.style(); shapeStyle.fill.color = 'pink'; shapeStyle.fill.transparency = 0.8; shapeStyle.line.color = 'black'; shapeStyle.line.lineStyle = GC.Spread.Sheets.Shapes.PresetLineDashStyle.dashDot; shapeStyle.line.width = 4; shapeStyle.line.capType = GC.Spread.Sheets.Shapes.LineCapStyle.square; shapeStyle.line.joinType = GC.Spread.Sheets.Shapes.LineJoinStyle.miter; shapeStyle.line.transparency = 0.1; shape.style(shapeStyle); } @NgModule({ imports: [BrowserModule, SpreadSheetsModule], declarations: [AppComponent], exports: [AppComponent], bootstrap: [AppComponent] }) export class AppModule { } enableProdMode(); // Bootstrap application with hash style navigation and global services. platformBrowserDynamic().bootstrapModule(AppModule);
<!doctype html> <html style="height:100%;font-size:14px;"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" type="text/css" href="$DEMOROOT$/en/angular/node_modules/@mescius/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <!-- Polyfills --> <script src="$DEMOROOT$/en/angular/node_modules/core-js/client/shim.min.js"></script> <script src="$DEMOROOT$/en/angular/node_modules/zone.js/fesm2015/zone.min.js"></script> <!-- SystemJS --> <script src="$DEMOROOT$/en/angular/node_modules/systemjs/dist/system.js"></script> <script src="systemjs.config.js"></script> <script> // workaround to load 'rxjs/operators' from the rxjs bundle System.import('rxjs').then(function (m) { System.import('@angular/compiler'); System.set(SystemJS.resolveSync('rxjs/operators'), System.newModule(m.operators)); System.import('$DEMOROOT$/en/lib/angular/license.ts'); System.import('./src/app.component'); }); </script> </head> <body> <app-component></app-component> </body> </html>
<div class="sample-tutorial"> <gc-spread-sheets class="sample-spreadsheets" [hostStyle]="hostStyle" (workbookInitialized)="initSpread($event)"> <gc-worksheet [name]="'CameraShape'"></gc-worksheet> </gc-spread-sheets> </div>
.sample-tutorial { position: relative; width: 100%; height: 100%; overflow: hidden; } body { position: absolute; top: 0; bottom: 0; left: 0; right: 0; }
(function (global) { System.config({ transpiler: 'ts', typescriptOptions: { tsconfig: true }, meta: { 'typescript': { "exports": "ts" }, '*.css': { loader: 'css' } }, paths: { // paths serve as alias 'npm:': 'node_modules/' }, // map tells the System loader where to look for things map: { 'core-js': 'npm:core-js/client/shim.min.js', 'zone': 'npm:zone.js/fesm2015/zone.min.js', 'rxjs': 'npm:rxjs/dist/bundles/rxjs.umd.min.js', '@angular/core': 'npm:@angular/core/fesm2022', '@angular/common': 'npm:@angular/common/fesm2022/common.mjs', '@angular/compiler': 'npm:@angular/compiler/fesm2022/compiler.mjs', '@angular/platform-browser': 'npm:@angular/platform-browser/fesm2022/platform-browser.mjs', '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/fesm2022/platform-browser-dynamic.mjs', '@angular/common/http': 'npm:@angular/common/fesm2022/http.mjs', '@angular/router': 'npm:@angular/router/fesm2022/router.mjs', '@angular/forms': 'npm:@angular/forms/fesm2022/forms.mjs', 'jszip': 'npm:jszip/dist/jszip.min.js', 'typescript': 'npm:typescript/lib/typescript.js', 'ts': './plugin.js', 'tslib':'npm:tslib/tslib.js', 'css': 'npm:systemjs-plugin-css/css.js', 'plugin-babel': 'npm:systemjs-plugin-babel/plugin-babel.js', 'systemjs-babel-build':'npm:systemjs-plugin-babel/systemjs-babel-browser.js', '@mescius/spread-sheets': 'npm:@mescius/spread-sheets/index.js', '@mescius/spread-sheets-shapes': 'npm:@mescius/spread-sheets-shapes/index.js', '@mescius/spread-sheets-angular': 'npm:@mescius/spread-sheets-angular/fesm2020/mescius-spread-sheets-angular.mjs', '@grapecity/jsob-test-dependency-package/react-components': 'npm:@grapecity/jsob-test-dependency-package/react-components/index.js' }, // packages tells the System loader how to load when no filename and/or no extension packages: { src: { defaultExtension: 'ts' }, rxjs: { defaultExtension: 'js' }, "node_modules": { defaultExtension: 'js' }, "node_modules/@angular": { defaultExtension: 'mjs' }, "@mescius/spread-sheets-angular": { defaultExtension: 'mjs' }, '@angular/core': { defaultExtension: 'mjs', main: 'core.mjs' } } }); })(this);