Struct in struct

Excel nesting specification of struct in struct.

Struct in struct

A worksheet ItemConf in HelloWorld.xlsx:

RewardIDRewardItemIDRewardItemNum
{Reward}int32{Item}int32int32
Reward’s IDItem’s IDItem’s num
1110

Generated:

hello_world.proto
// --snip--
option (tableau.workbook) = {name:"HelloWorld.xlsx"};

message ItemConf {
  option (tableau.worksheet) = {name:"ItemConf" namerow:1 typerow:2 noterow:3 datarow:4};

  Reward reward = 1 [(tableau.field) = {name:"Reward"}];
  message Reward {
    int32 id = 1 [(tableau.field) = {name:"ID"}];
    Item item = 2 [(tableau.field) = {name:"Item"}];
    message Item {
      int32 id = 1 [(tableau.field) = {name:"ID"}];
      int32 num = 2 [(tableau.field) = {name:"Num"}];
    }
  }
}
ItemConf.json
{
    "reward": {
        "id": 1,
        "item": {
            "id": 1,
            "num": 10
        }
    }
}

Predefined-struct in struct

Item in common.proto is predefined as:

message Item {
    int32 id = 1 [(tableau.field) = {name:"ID"}];
    int32 num = 2 [(tableau.field) = {name:"Num"}];
}

A worksheet ItemConf in HelloWorld.xlsx:

RewardIDRewardItemIDRewardItemNum
{Reward}int32{.Item}int32int32
Reward’s IDItem’s IDItem’s num
1110

Generated:

hello_world.proto
// --snip--
import "common.proto";
option (tableau.workbook) = {name:"HelloWorld.xlsx"};

message ItemConf {
  option (tableau.worksheet) = {name:"ItemConf" namerow:1 typerow:2 noterow:3 datarow:4};

  Reward reward = 1 [(tableau.field) = {name:"Reward"}];
  message Reward {
    int32 id = 1 [(tableau.field) = {name:"ID"}];
    protoconf.Item item = 2 [(tableau.field) = {name:"Item"}];
  }
}
ItemConf.json
{
    "reward": {
        "id": 1,
        "item": {
            "id": 1,
            "num": 10
        }
    }
}

Incell-struct in struct

A worksheet ItemConf in HelloWorld.xlsx:

RewardIDRewardItem
{Reward}int32{int32 ID, int32 Num}Item
Reward’s IDReward’s item
11,100
2,200

Generated:

hello_world.proto
// --snip--
option (tableau.workbook) = {name:"HelloWorld.xlsx"};

message ItemConf {
  option (tableau.worksheet) = {name:"ItemConf" namerow:1 typerow:2 noterow:3 datarow:4};

  Reward reward = 1 [(tableau.field) = {name:"Reward"}];
  message Reward {
    int32 id = 1 [(tableau.field) = {name:"ID"}];
    Item item = 2 [(tableau.field) = {name:"Item" span:SPAN_INNER_CELL}];
    message Item {
      int32 id = 1 [(tableau.field) = {name:"ID"}];
      int32 num = 2 [(tableau.field) = {name:"Num"}];
    }
  }
}
ItemConf.json
{
    "reward": {
        "id": 1,
        "item": {
            "id": 2,
            "num": 200
        }
    }
}