[{"id":"ff9bd47a-cd46-472d-af43-366f35920ef1","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"f674ca00-4cf2-4f53-9a08-4aa596ff5f02","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"5f9ed446-5e43-4e35-b070-bbedb3095625","tags":[{"product":null,"links":null,"id":"6c1a6899-1b88-404c-9a73-4a0c6c9090a3","name":"New","color":"Red","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"c8f61bda-f911-4c26-aa5c-cf046d91d345","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"ffcf2b4f-0e46-41d0-b0b7-0cc510a2a482","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"4200be12-4188-42f3-9cf4-5fcaebbc57f7","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"7bc4edb3-af3c-4fe3-8820-973c7b43d825","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"af815243-c00f-4782-b362-bb52a9129e99","tags":[{"product":null,"links":null,"id":"6c1a6899-1b88-404c-9a73-4a0c6c9090a3","name":"New","color":"Red","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"bd8aaf4e-1ba8-4025-8ba9-d57cfbefbc58","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"874f311d-9a12-4e41-9c01-e7aaa99ab496","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"5811b0f0-9142-4dec-87d5-11fbd1e001ec","tags":[{"product":null,"links":null,"id":"6c1a6899-1b88-404c-9a73-4a0c6c9090a3","name":"New","color":"Red","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"cef428a7-3494-4942-81f6-6712e4b9d1e7","tags":[{"product":null,"links":null,"id":"6c1a6899-1b88-404c-9a73-4a0c6c9090a3","name":"New","color":"Red","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"3be03770-5428-4ad4-8ebc-09708a22e209","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"563145bf-65b2-4718-851d-594d1b9cf1f6","tags":[{"product":null,"links":null,"id":"6c1a6899-1b88-404c-9a73-4a0c6c9090a3","name":"New","color":"Red","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"b273295a-e4a0-45ad-be8a-5c3a2322d22c","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"76f8df3f-5d71-4244-8fa6-6be30e10170f","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"7990d3f5-9c4c-4c37-9a96-7e7b1cf0e531","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"a5d052e6-ac14-4b26-b51d-2042af4bd88c","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"4a6e9860-0849-40aa-8cdb-c16c5fb52ef4","tags":[{"product":null,"links":null,"id":"6c1a6899-1b88-404c-9a73-4a0c6c9090a3","name":"New","color":"Red","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"b02661dd-4bf2-4e6a-94c0-c85827e19c52","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"06c9877a-acd0-49b6-8a35-52d10c942e21","tags":[{"product":null,"links":null,"id":"6c1a6899-1b88-404c-9a73-4a0c6c9090a3","name":"New","color":"Red","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"b9cc95e6-4c7e-4ae6-9168-6270c8b9df48","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"81742c3e-102a-44f5-8e12-83cdddf79651","tags":[{"product":null,"links":null,"id":"6c1a6899-1b88-404c-9a73-4a0c6c9090a3","name":"New","color":"Red","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"f6568a5c-eb38-4edb-af3a-8af10e64b122","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"f30f3e16-1db8-48eb-b7a8-de189c306e42","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"c38d9bd1-ec29-4861-bea2-e9939a1d40b8","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"c7f7e6eb-630d-4851-ab1a-eeafb6882ff9","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"e82078d4-d506-4d51-83ea-129c35f610c2","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"2cf396a7-8e6d-4ece-867e-2a346c855b76","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"7fdf2b77-d2f1-440f-8bde-79873ae161be","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"4bfbb7a7-db6a-4e62-9bb9-043090f29e06","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"4acb1bbe-766a-4271-a1e7-156999bf6da7","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"e2476b8f-2102-441c-9f8c-bbd9ca5f94c8","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"eeba73bc-77fb-4e4c-addd-f365b53e009b","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"604aae49-9273-455c-813b-c2c97aa713c7","tags":[{"product":null,"links":null,"id":"6c1a6899-1b88-404c-9a73-4a0c6c9090a3","name":"New","color":"Red","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"fd995bda-fac2-4ef5-ab75-d8f6840b937a","tags":[{"product":null,"links":null,"id":"6c1a6899-1b88-404c-9a73-4a0c6c9090a3","name":"New","color":"Red","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"24dbdbdf-1539-4e43-8f9f-036adaf28f36","tags":[{"product":null,"links":null,"id":"6c1a6899-1b88-404c-9a73-4a0c6c9090a3","name":"New","color":"Red","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"6896e627-8625-484c-9487-48803c13019b","tags":[{"product":null,"links":null,"id":"6c1a6899-1b88-404c-9a73-4a0c6c9090a3","name":"New","color":"Red","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"035cce7b-7cfc-405b-b003-419583668944","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"139bcd73-12b9-4e78-843c-dd63933e35b8","tags":[{"product":null,"links":null,"id":"6c1a6899-1b88-404c-9a73-4a0c6c9090a3","name":"New","color":"Red","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"f38fe005-cfd6-4f25-9c83-f5a545aaa911","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"5fa9f1d8-ed73-4642-82cd-cb4f7a9a145a","tags":[{"product":null,"links":null,"id":"2f522515-8c88-4017-855d-905bc4b0ea3c","name":"Upd","color":"Blue","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]},{"id":"09b280d0-fc2f-438a-8d57-e87c6ef02d8b","tags":[{"product":null,"links":null,"id":"6c1a6899-1b88-404c-9a73-4a0c6c9090a3","name":"New","color":"Red","productId":"66a69675-7df9-45b2-867a-4ab2613535fa"}]}]
        
(Showing Draft Content)

アウトライン列

Spread.Sheetsのアウトライン列では、列内のインデントテキストにより、スプレッドシート内にツリーのような構造を作成して、データがどのように編成されているかを分かりやすく示します。

この機能を使用すると、各行の階層関係を示し、展開および折りたたみを行う組み込みユーザーインタフェースをスプレッドシートに追加できます。また、この機能は、プロジェクト計画タスクとプロジェクト計画サブタスクの階層を作成する場合、財務諸表や部品表(BOM)を作成する場合など、スプレッドシート内に大量のデータが含まれる場合にたいへん便利です。

ワークシート内の列をアウトライン化することもできますが、折りたたみおよび展開アイコンとともに、チェックボックスや画像を追加することもできます。

次の画像は、折りたたみおよび展開アイコンを備えたアウトライン列、チェックボックス、画像、および行アウトラインを設定したスプレッドシートを示します。


ワークシートに折りたたみおよび展開アイコンを実装するには、showRowOutlineメソッドを使用します。ツリー構造内のレベル数は、インデントの数に対応します。

レベルごとに画像をカスタマイズすることも、カスタムインジケータやチェックボックスを表示することも、階層の最大レベルを設定することもできます。これには、 outlineColumn.options を使用します。

コードの使用

次のサンプルコードは、列にインデントを設定し、画像とチェックボックスを追加する方法を示します。

var rowCount = 38;
var colCount = 10;
activeSheet.setColumnCount(colCount);
activeSheet.setRowCount(rowCount);
activeSheet.setColumnWidth(0, 310);
activeSheet.setColumnWidth(1, 150);
activeSheet.setColumnWidth(2, 150);
activeSheet.frozenColumnCount(1);
activeSheet.setValue(0, 0, "Name", GC.Spread.Sheets.SheetArea.colHeader);
activeSheet.setValue(0, 1, "Chapter", GC.Spread.Sheets.SheetArea.colHeader);
activeSheet.setValue(0, 2, "Page", GC.Spread.Sheets.SheetArea.colHeader);
var commands = [
    {name: 'Preface', chapter: '1', page: 1, indent: 0},
    {name: 'Java SE5 and SE6', chapter: '1.1', page: 2, indent: 1},
    {name: 'Java SE6', chapter: '1.1.1', page: 2, indent: 2},
    {name: 'The 4th edition', chapter: '1.2', page: 2, indent: 1},
    {name: 'Changes', chapter: '1.2.1', page: 3, indent: 2},
    {name: 'Note on the cover design', chapter: '1.3', page: 4, indent: 1},
    {name: 'Acknowledgements', chapter: '1.4', page: 4, indent: 1},
    {name: 'Introduction', chapter: '2', page: 9, indent: 0},
    {name: 'Prerequisites', chapter: '2.1', page: 9, indent: 1},
    {name: 'Learning Java', chapter: '2.2', page: 10, indent: 1},
    {name: 'Goals', chapter: '2.3', page: 10, indent: 1},
    {name: 'Teaching from this book', chapter: '2.4', page: 11, indent: 1},
    {name: 'JDK HTML documentation', chapter: '2.5', page: 11, indent: 1},
    {name: 'Exercises', chapter: '2.6', page: 12, indent: 1},
    {name: 'Foundations for Java', chapter: '2.7', page: 12, indent: 1},
    {name: 'Source code', chapter: '2.8', page: 12, indent: 1},
    {name: 'Coding standards', chapter: '2.8.1', page: 14, indent: 2},
    {name: 'Errors', chapter: '2.9', page: 14, indent: 1},
    {name: 'Introduction to Objects', chapter: '3', page: 15, indent: 0},
    {name: 'The progress of abstraction', chapter: '3.1', page: 15, indent: 1},
    {name: 'An object has an interface', chapter: '3.2', page: 17, indent: 1},
    {name: 'An object provides services', chapter: '3.3', page: 18, indent: 1},
    {name: 'The hidden implementation', chapter: '3.4', page: 19, indent: 1},
    {name: 'Reusing the implementation', chapter: '3.5', page: 20, indent: 1},
    {name: 'Inheritance', chapter: '3.6', page: 21, indent: 1},
    {name: 'Is-a vs. is-like-a relationships', chapter: '3.6.1', page: 24, indent: 2},
    {name: 'Interchangeable objects with polymorphism', chapter: '3.7', page: 25, indent: 1},
    {name: 'The singly rooted hierarchy', chapter: '3.8', page: 28, indent: 1},
    {name: 'Containers', chapter: '3.9', page: 28, indent: 1},
    {name: 'Parameterized types (Generics)', chapter: '3.10', page: 29, indent: 1},
    {name: 'Object creation & lifetime', chapter: '3.11', page: 30, indent: 1},
    {name: 'Exception handling: dealing with errors', chapter: '3.12', page: 31, indent: 1},
    {name: 'Concurrent programming', chapter: '3.13', page: 32, indent: 1},
    {name: 'Java and the Internet', chapter: '3.14', page: 33, indent: 1},
    {name: 'What is the Web?', chapter: '3.14.1', page: 33, indent: 2},
    {name: 'Client-side programming', chapter: '3.14.2', page: 34, indent: 2},
    {name: 'Server-side programming', chapter: '3.14.3', page: 38, indent: 2},
    {name: 'Summary', chapter: '3.15', page: 38, indent: 1},
];
for (var r = 0; r < commands.length; r++) {
    activeSheet.setValue(r, 0, commands[r]['name']);
    activeSheet.setValue(r, 1, commands[r]['chapter']);
    activeSheet.setValue(r, 2, commands[r]['page']);
    activeSheet.getRange(r, 0, 1, 1).textIndent(commands[r].indent);
}
activeSheet.outlineColumn.options({
columnIndex: 0,
showImage: true,
showCheckBox: true,
images: ['star2.png', 'box4.png', 'rating4.png'],
maxLevel: 2
});
activeSheet.showRowOutline(true);
spread.invalidateLayout();
spread.repaint();

注: この機能には、以下の制限があります。

  • 新規挿入した行のレベルは、行を挿入したときに選択されていた行の、1つ前の行と同じレベルとなります。

  • sortRangeメソッドを実行すると、インデントテキストが再計算され、インデント列が更新されます。

  • ドラッグフィルおよびドラッグ移動を行うと、セルの内容のみが変更されます。

  • コピーおよび貼り付けを行うと、セルの内容のみが変更されます。