import * as React from 'react';
import GC from '@grapecity/spread-sheets';
import '@grapecity/spread-sheets-resources-zh';
GC.Spread.Common.CultureManager.culture("zh-cn");
import { SpreadSheets, Worksheet } from '@grapecity/spread-sheets-react';
import './styles.css';
export function AppFunc() {
let initSpread = function (value) {
const tip=['提示1哇恶气请问','提示2请问企鹅']
let spread = value;
let sheet1 = spread.getSheet(0);
sheet1.setValue(0, 0, 'Hello World!');
sheet1.setValue(0, 1, 'Hello World!');
tip.forEach((item,index)=>{
const comment = sheet1.comments.add(0, index, item)
comment.foreColor('#FFF')
comment.backColor('#1f2733')
comment.fontSize('14px')
comment.padding(new GC.Spread.Sheets.Comments.Padding(10, 8, 10, 8))
comment.horizontalAlign(GC.Spread.Sheets.HorizontalAlign.center)
comment.autoSize(true)
})
}
return (<div class="sample-tutorial">
<div class="sample-spreadsheets">
<SpreadSheets workbookInitialized={spread => initSpread(spread)}>
<Worksheet></Worksheet>
</SpreadSheets>
</div>
</div>);
}
css部分
.sample-tutorial {
position: relative;
height: 100%;
overflow: hidden;
}
.sample-spreadsheets {
width: 100%;
height: 100%;
}
body {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
#app {
height: 100%;
}
.gc-spread-floatBlockCanvas-container {
.gc-spread-host-container {
border-style: none !important;
.gc-spread-host {
height: auto !important;
border-radius: 6px;
}
}
}
.gc-spread-lineCanvas-container {
display: none;
} |