Scalar(标量)

本文说明 Excel scalar 类型的各种特性。

Scalar

HelloWorld.xlsx 中的 worksheet Apple

IDNameDesc
uint32stringstring
Item’s IDItem’s NameItem’s Description
1AppleA kind of delicious fruit.

该 worksheet 中定义了三个 scalar 字段:

  1. ID:uint32
  2. Name:string
  3. Desc:string

生成结果:

hello_world.proto
// --snip--
option (tableau.workbook) = {name:"HelloWorld.xlsx" namerow:1 typerow:2 noterow:3 datarow:4};

message Apple {
  option (tableau.worksheet) = {name:"Apple"};

  uint32 id = 1 [(tableau.field) = {name:"ID"}];
  string name = 2 [(tableau.field) = {name:"Name"}];
  string desc = 3 [(tableau.field) = {name:"Desc"}];
}
Apple.json
{
    "id": 1,
    "name": "Apple",
    "desc": "A kind of delicious fruit."
}

说明

Scalar 类型通常用于定义 struct 类型的字段。Struct →