2014/05/12

Office 365 Access アプリ -51- Access 用コンテンツ アプリ - 5

どこに保管されるのだろうと思って。
Access アプリ を終了してから再度起動しても同じ情報を取得できるのだからきっとデータベース上にあるんだろうと思って確かめてみただけ。
SELECT [ID]
      ,[ObjectName]
      ,[Definition]
  FROM [AccessSystem].[Objects]
 WHERE [ObjectTypeNumber] = 112
ここでした。

こんな感じで保存される
<AppForOffice>
 <Binding Name="bindTable1" Type="1" Object="Table1">
  <ColumnNames>
   <ColumnName>F01</ColumnName>
   <ColumnName>F02</ColumnName>
  </ColumnNames>
 </Binding>
 <Binding Name="bindTable2" Type="1" Object="Table2">
  <ColumnNames>
   <ColumnName>F01</ColumnName>
   <ColumnName>F02</ColumnName>
  </ColumnNames>
 </Binding>
 <CustomSettings>
  <CustomSetting Name="set1" Value="999" />
 </CustomSettings>
</AppForOffice>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <title></title>
    <script src="../../Scripts/jquery-1.9.1.js" type="text/javascript"></script>

    <link href="../../Content/Office.css" rel="stylesheet" type="text/css" />
    <script src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js" 
            type="text/javascript"></script>

    <link href="Home.css" rel="stylesheet" type="text/css" />
    <script src="Home.js" type="text/javascript"></script>
</head>
<body>
    <div id="content-main">
        <div class="padding">
            <button id="set-binding1">set-binding1</button>
            <button id="set-binding2">set-binding2</button>
            <button id="set-setting">set-setting</button>
            <button id="remove-setting">remove-setting</button>
            <div id="data-display" />
        </div>
    </div>
</body>
</html>
(function () {
    "use strict";

    Office.initialize = function (reason) {
        $(document).ready(function () {

            $('#set-binding1').click(addBinding1);
            $('#set-binding2').click(addBinding2);
            $('#set-setting').click(saveSetting);
            $('#remove-setting').click(removeSetting);
        });
    };

    function addBinding1() {
        Office.context.document.bindings.addFromNamedItemAsync(
            "Table1",
            Office.BindingType.Table,
            { id: "bindTable1" },
            function (result) {
                dataDisplay(result.value.id + ':' + result.status)
            });
    }

    function addBinding2() {
        Office.context.document.bindings.addFromNamedItemAsync(
            "Table2",
            Office.BindingType.Table,
            { id: "bindTable2" },
            function (result) {
                dataDisplay(result.value.id + ':' + result.status)
            });
    }

    function saveSetting() {
        Office.context.document.settings.set('set1', 999);
        Office.context.document.settings.saveAsync(
            function (result) {
                dataDisplay(result.status)
            });

    }

    function removeSetting() {
        Office.context.document.settings.remove('set1');
        Office.context.document.settings.saveAsync(
            function (result) {
                dataDisplay(result.status)
            });
    }

    function dataDisplay(string) {
        $('#data-display').empty().append('<p>' + string + '</p>')
    }
})();

0 件のコメント: