Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            //var entity = new RangeEntity();
            //var data = entity.GetRanges();

            //var data2 = new string[2][];
            //data2[0] = new String[] { "1", "2"};
            //data2[1] = new String[] { "3", "4"};

            //var entity2 = new RangeDataEntity();
            //entity2.UploadRange("Guest", "435test", "foobar", "$A1:$B2", data2);

            //var entity3 = new RangeDataEntity();
            //var result = entity2.DownLoadRange(4);

            var entity = new RangeEntity();
            var data = entity.GetMyRanges("tonyj.lei");

            var data2 = new string[2][];
            data2[0] = new String[] { "1", "2" };
            data2[1] = new String[] { "3", "4" };

            var entity2 = new RangeDataEntity();
            entity2.TargetedUploadRange("Guest", "435test", "foobar", "$A1:$B2", data2, new String[] { "saad.shaharyar,tony.lei"});
        }
Ejemplo n.º 2
0
        public string UploadRange(string name, string desc, string xlAddress, ref string []allowedUsers, string fileName)
        {
            RangeDataEntity entity = new RangeDataEntity();
            string result;
            string[][] data;
            int rows;
            int cols;

            using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                using (StreamReader sr = new StreamReader(fs, Encoding.UTF8))
                {
                    rows = int.Parse(sr.ReadLine());
                    cols = int.Parse(sr.ReadLine());
                    sr.ReadLine();

                    data = new string[rows][];
                    for (int r = 0; r < rows; r++)
                    {
                        data[r] = new string[cols];
                        for (int c = 0; c < cols; c++)
                        {
                            data[r][c] = sr.ReadLine();
                        }
                    }
                }
            }

            result = entity.TargetedUploadRange(Environment.UserName, name, desc, xlAddress, data, allowedUsers);
            File.Delete(fileName);

            return result;
        }