请选择 进入手机版 | 继续访问电脑版
 找回密码
 立即注册

QQ登录

只需一步,快速开始

路过留痕

注册会员

12

主题

21

帖子

123

积分

注册会员

积分
123

[已处理] 无法设置中文

路过留痕
注册会员   /  发表于:2021-2-25 14:47  /   查看:1403  /  回复:1
无法设置中文,按照demo写也不行。
  1. import * as React from 'react';
  2. import * as ReactDOM from 'react-dom';
  3. import GC from '@grapecity/spread-sheets';
  4. import { SpreadSheets, Worksheet } from '@grapecity/spread-sheets-react';
  5. import '@grapecity/spread-sheets-resources-zh';
  6. GC.Spread.Common.CultureManager.culture("zh-cn");
  7. import './style.css';

  8. const Component = React.Component;

  9. function _getElementById(id) {
  10.     return document.getElementById(id);
  11. }

  12. class Daywork extends Component {

  13.     constructor(props) {
  14.         super(props);
  15.         this.spread = null;
  16.     }
  17.     render() {
  18.         return <div sytle={{width:800,height:800}}><div class="sample-tutorial">
  19.             <div class="sample-spreadsheets">
  20.                 <SpreadSheets hostStyle={{ width: 800, height: 300 }} workbookInitialized={spread => this.initSpread(spread)}>
  21.                     <Worksheet>
  22.                     </Worksheet>
  23.                 </SpreadSheets>
  24.             </div>
  25.             <div className="options-container">
  26.                 <div className="option-row">
  27.                     <label>Culture:</label>
  28.                     <select id="cultureName" onChange={e=>this.changeCultureName(e)}>
  29.                         <option value="en-us" selected>English</option>
  30.                         <option value="zh-cn">Chinese</option>
  31.                         <option value="ja-jp">Japanese</option>
  32.                         <option value="ko-kr">Korean</option>
  33.                     </select>
  34.                 </div>
  35.                 <div className="option-row">
  36.                     <ul style={{ margin: 0, paddingLeft: '20px' }}>
  37.                         <li>Perform any of the below actions to view the results:</li>
  38.                         <div>- Click a filter dropdown in the column header</div>
  39.                         <div>- Resize a column or row header</div>
  40.                         <div>- Use the scrollbar to scroll the contents</div>
  41.                         <li>To view localized formula descriptions:</li>
  42.                         <div>- Double click cell B11 or B12</div>
  43.                         <div>- Click to edit the formula to view the updated descriptions</div>
  44.                     </ul>
  45.                 </div>
  46.             </div>
  47.         </div>
  48.         </div>;
  49.     }

  50.     initSpread(spread) {
  51.         this.spread = spread;
  52.         spread.suspendPaint();
  53.         let spreadNS = GC.Spread.Sheets;
  54.         spread.options.showResizeTip = spreadNS.ShowResizeTip.both;
  55.         spread.options.showScrollTip = spreadNS.ShowScrollTip.both;
  56.         let sheet = spread.getActiveSheet();
  57.         for (let r = 0; r < 10; r++) {
  58.             for (let c = 0; c < 5; c++) {
  59.                 sheet.setValue(r, c, r + c);
  60.             }
  61.         }
  62.         sheet.rowFilter(new spreadNS.Filter.HideRowFilter(new spreadNS.Range(0, 0, 10, 5)));
  63.         sheet.setValue(10, 0, "SUM:");
  64.         sheet.setFormula(10, 1, "SUM(A1:E10)");
  65.         sheet.setValue(11, 0, "PIESPARKLINE:");
  66.         sheet.setFormula(11, 1, 'PIESPARKLINE(A1:E10,"yellow", "green")');
  67.         sheet.setRowHeight(11, 100);
  68.         sheet.setColumnWidth(0, 120);
  69.         sheet.setColumnWidth(1, 100);
  70.         spread.resumePaint();

  71.         GC.Spread.Common.CultureManager.culture("zh-cn");
  72.     }
  73.     changeCultureName (e) {
  74.         GC.Spread.Common.CultureManager.culture(e.target.value);
  75.     }
  76. }

  77. export default Daywork;

复制代码


1 个回复

倒序浏览
Derrick.Jiao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
论坛元老   /  发表于:2021-2-25 15:15:53
沙发
您好,建议您参考下图的顺序引入,若仍未解决您的问题,建议您提供完整能复现问题的demo
image.png776941833.png
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部