Пример #1
0
        public List <TextItem> GetTextItems()
        {
            //check whether file is set or not
            if (FileName == "")
            {
                throw new Exception("No file name specified");
            }

            //build URI
            string strURI = Saaspose.Common.Product.BaseProductUri + "/cells/" + FileName;

            strURI += "/textItems";

            //sign URI
            string signedURI = Utils.Sign(strURI);

            StreamReader reader = new StreamReader(Utils.ProcessCommand(signedURI, "GET"));

            //further process JSON response
            string strJSON = reader.ReadToEnd();

            //Parse the json string to JObject
            JObject parsedJSON = JObject.Parse(strJSON);

            //Deserializes the JSON to a object.
            TextEditorResponse textEditorResponse = JsonConvert.DeserializeObject <TextEditorResponse>(parsedJSON.ToString());

            return(textEditorResponse.TextItems.TextItemList);
        }
Пример #2
0
        public int ReplaceText(string oldText, string newText)
        {
            //check whether file is set or not
            if (FileName == "")
            {
                throw new Exception("No file name specified");
            }

            //build URI
            string strURI = Saaspose.Common.Product.BaseProductUri + "/cells/" + FileName;

            strURI += "/replaceText?oldValue=" + oldText + "&newValue=" + newText;

            //sign URI
            string signedURI = Utils.Sign(strURI);

            StreamReader reader = new StreamReader(Utils.ProcessCommand(signedURI, "POST"));

            //further process JSON response
            string strJSON = reader.ReadToEnd();

            //Parse the json string to JObject
            JObject parsedJSON = JObject.Parse(strJSON);

            //Deserializes the JSON to a object.
            TextEditorResponse textEditorResponse = JsonConvert.DeserializeObject <TextEditorResponse>(parsedJSON.ToString());

            return(textEditorResponse.Matches);
        }