标量(Scalar)

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

标量(Scalar)

HelloWorld.xlsx 中的工作表 Apple

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

该工作表中定义了三个标量字段:

  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."
}

说明

标量类型通常用于定义结构体类型的字段。