Beispiel #1
0
        /// <summary>
        /// カラム数が変わっていたら表を拡張してカラム名を更新
        /// </summary>
        /// <param name="wsEntry"></param>
        /// <param name="columns"></param>
        /// <returns></returns>
        protected WorksheetEntry CheckColumns(WorksheetEntry wsEntry, string[] columns)
        {
            if (columns.Length > wsEntry.Cols)
            {
                wsEntry.Cols = (uint)columns.Length;

                WorksheetEntry newEntry = (WorksheetEntry)wsEntry.Update();

                /*
                 * http://stackoverflow.com/questions/22719170/updating-cell-in-google-spreadsheets-returns-error-missing-resource-version-id
                 * http://stackoverflow.com/questions/20841411/google-spreadsheets-api-c-sharp-missing-resource-version-id-on-batch-update/23438381
                 *
                 * ETag:*をするとか、そもそもBatchよりPublishの方が分かりやすい、とか。
                 */
                CellFeed cellFeed = wsEntry.QueryCellFeed();

                uint col = 1;
                foreach (var it in columns)
                {
                    CellEntry batchEntry = cellFeed[1, col++];
                    batchEntry.InputValue = it;
                    batchEntry.Etag       = "*";
                }
                cellFeed.Publish();

                return(newEntry);
            }
            return(wsEntry);
        }
Beispiel #2
0
        private static void AddNewLocalisation(string key, string text)
        {
            WorksheetEntry worksheet = GetWorksheet();

            uint row = ++worksheet.Rows;

            worksheet.Update();

            CellQuery cellQuery = new CellQuery(worksheet.CellFeedLink);

            cellQuery.MinimumRow    = row;
            cellQuery.ReturnEmpty   = ReturnEmptyCells.yes;
            cellQuery.MinimumColumn = 1;
            cellQuery.MaximumColumn = 2;
            CellFeed cellFeed = ss.Query(cellQuery);

            foreach (CellEntry cell in cellFeed.Entries)
            {
                switch (cell.Column)
                {
                case 1:
                    cell.InputValue = key;
                    break;

                case 2:
                    cell.InputValue = text;
                    break;
                }

                cell.Update();
            }
        }
Beispiel #3
0
        private bool setup()
        {
            WorksheetEntry ws = this.access.getDataWorksheet();

            if (ws.Title.Text != "Data")
            {
                ws.Title.Text = "Data";
                ws.Update();
                return(true);
            }
            return(false);
        }
Beispiel #4
0
        public void AddNewHeader(string header)
        {
            WorksheetEntry.Cols += 1;
            WorksheetEntry.Update();
            CellQuery cellQuery = new CellQuery(WorksheetEntry.CellFeedLink);

            cellQuery.MaximumRow = 1;
            //cellQuery.Range = "A543:L543";
            CellFeed  cellFeed  = service.Query(cellQuery);
            CellEntry cellEntry = new CellEntry(1, (uint)cellFeed.Entries.Count + 1, header);

            cellFeed.Insert(cellEntry);
        }