无法设置中文,按照demo写也不行。- import * as React from 'react';
- import * as ReactDOM from 'react-dom';
- import GC from '@grapecity/spread-sheets';
- import { SpreadSheets, Worksheet } from '@grapecity/spread-sheets-react';
- import '@grapecity/spread-sheets-resources-zh';
- GC.Spread.Common.CultureManager.culture("zh-cn");
- import './style.css';
- const Component = React.Component;
- function _getElementById(id) {
- return document.getElementById(id);
- }
- class Daywork extends Component {
- constructor(props) {
- super(props);
- this.spread = null;
- }
- render() {
- return <div sytle={{width:800,height:800}}><div class="sample-tutorial">
- <div class="sample-spreadsheets">
- <SpreadSheets hostStyle={{ width: 800, height: 300 }} workbookInitialized={spread => this.initSpread(spread)}>
- <Worksheet>
- </Worksheet>
- </SpreadSheets>
- </div>
- <div className="options-container">
- <div className="option-row">
- <label>Culture:</label>
- <select id="cultureName" onChange={e=>this.changeCultureName(e)}>
- <option value="en-us" selected>English</option>
- <option value="zh-cn">Chinese</option>
- <option value="ja-jp">Japanese</option>
- <option value="ko-kr">Korean</option>
- </select>
- </div>
- <div className="option-row">
- <ul style={{ margin: 0, paddingLeft: '20px' }}>
- <li>Perform any of the below actions to view the results:</li>
- <div>- Click a filter dropdown in the column header</div>
- <div>- Resize a column or row header</div>
- <div>- Use the scrollbar to scroll the contents</div>
- <li>To view localized formula descriptions:</li>
- <div>- Double click cell B11 or B12</div>
- <div>- Click to edit the formula to view the updated descriptions</div>
- </ul>
- </div>
- </div>
- </div>
- </div>;
- }
- initSpread(spread) {
- this.spread = spread;
- spread.suspendPaint();
- let spreadNS = GC.Spread.Sheets;
- spread.options.showResizeTip = spreadNS.ShowResizeTip.both;
- spread.options.showScrollTip = spreadNS.ShowScrollTip.both;
- let sheet = spread.getActiveSheet();
- for (let r = 0; r < 10; r++) {
- for (let c = 0; c < 5; c++) {
- sheet.setValue(r, c, r + c);
- }
- }
- sheet.rowFilter(new spreadNS.Filter.HideRowFilter(new spreadNS.Range(0, 0, 10, 5)));
- sheet.setValue(10, 0, "SUM:");
- sheet.setFormula(10, 1, "SUM(A1:E10)");
- sheet.setValue(11, 0, "PIESPARKLINE:");
- sheet.setFormula(11, 1, 'PIESPARKLINE(A1:E10,"yellow", "green")');
- sheet.setRowHeight(11, 100);
- sheet.setColumnWidth(0, 120);
- sheet.setColumnWidth(1, 100);
- spread.resumePaint();
- GC.Spread.Common.CultureManager.culture("zh-cn");
- }
- changeCultureName (e) {
- GC.Spread.Common.CultureManager.culture(e.target.value);
- }
- }
- export default Daywork;
复制代码
|
|