コード例 #1
0
        /// <summary>
        /// Load a worksheet from the selected spreadsheet
        /// </summary>
        /// <param name="spreadsheet"></param>
        /// <param name="workSheetName"></param>
        /// <returns></returns>
        public static GS2U_Worksheet LoadWorkSheet(this GS2U_SpreadSheet spreadsheet, string workSheetName)
        {
            WorksheetFeed wsFeed = spreadsheet.spreadsheetEntry.Worksheets;

            foreach (WorksheetEntry ws in wsFeed.Entries)
            {
                if (ws.Title.Text == workSheetName)
                {
                    return(new GS2U_Worksheet(ws));
                }
            }
            return(null);
        }
コード例 #2
0
        /// <summary>
        /// returns a list of all worksheet names known by a particular worksheet
        /// </summary>
        /// <param name="sheet"></param>
        /// <returns></returns>
        public static List <string> GetAllWorkSheetsNames(this GS2U_SpreadSheet sheet)
        {
            if (sheet.spreadsheetEntry.Worksheets.Entries.Count == 0)
            {
                return(null);
            }
            else
            {
                List <string> returnList = new List <string>();

                foreach (var entry in sheet.spreadsheetEntry.Worksheets.Entries)
                {
                    returnList.Add(entry.Title.Text);
                }
                return(returnList);
            }
        }
コード例 #3
0
        /// <summary>
        /// return a list of all worksheets on a spreadsheet
        /// </summary>
        /// <param name="sheet"></param>
        /// <returns></returns>
        public static List <GS2U_Worksheet> GetAllWorkSheets(this GS2U_SpreadSheet sheet)
        {
            if (sheet.spreadsheetEntry.Worksheets.Entries.Count == 0)
            {
                return(null);
            }
            else
            {
                List <GS2U_Worksheet> returnList = new List <GS2U_Worksheet>();

                foreach (var entry in sheet.spreadsheetEntry.Worksheets.Entries)
                {
                    returnList.Add(new GS2U_Worksheet((WorksheetEntry)entry));
                }

                return(returnList);
            }
        }
コード例 #4
0
        /// <summary>
        /// Creates a new worksheet on the selected spreadsheet of size columns x rows
        /// </summary>
        /// <param name="sheet"></param>
        /// <param name="worksheetTitle"></param>
        /// <param name="columns"></param>
        /// <param name="rows"></param>
        /// <returns></returns>
        public static GS2U_Worksheet AddNewWorksheet(this GS2U_SpreadSheet sheet, string worksheetTitle, int columns, int rows)
        {
            WorksheetEntry worksheet = new WorksheetEntry();

            worksheet.Title.Text = worksheetTitle;
            worksheet.Cols       = (uint)columns;
            worksheet.Rows       = (uint)rows;
            WorksheetFeed wsFeed = sheet.spreadsheetEntry.Worksheets;

            try
            {
                return(new GS2U_Worksheet(SpreadSheetManager.service.Insert(wsFeed, worksheet)));
            }
            catch
            {
                Debug.Log("Error adding new worksheet, name already exists");
                return(null);
            }
        }
コード例 #5
0
        /// <summary>
        /// load a worksheet from the selected spreadsheet
        /// </summary>
        /// <param name="spreadsheet"></param>
        /// <param name="worksheetNumber"></param>
        /// <returns></returns>
        public static GS2U_Worksheet LoadWorkSheet(this GS2U_SpreadSheet spreadsheet, int worksheetNumber)
        {
            WorksheetFeed wsFeed = spreadsheet.spreadsheetEntry.Worksheets;

            return(new GS2U_Worksheet((WorksheetEntry)wsFeed.Entries[worksheetNumber]));
        }