public void MergeWorkbook(string mergefileName) { try { //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 += "/merge?mergeWith=" + mergefileName; //sign URI string signedURI = Utils.Sign(strURI); //get response stream 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. WorkbookResponse docResponse = JsonConvert.DeserializeObject <WorkbookResponse>(parsedJSON.ToString()); } catch (Exception ex) { throw new Exception(ex.Message); } }
public Style getDefaultStyle() { //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 += "/defaultStyle"; //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. WorkbookResponse docResponse = JsonConvert.DeserializeObject <WorkbookResponse>(parsedJSON.ToString()); //return default Style return(docResponse.Style); }
/// <summary> /// Set document property /// </summary> /// <param name="propertyName">property name</param> /// <param name="propertyValue">property value</param> public void SetProperty(string propertyName, string propertyValue) { try { //build URI to get page count string strURI = Product.BaseProductUri + "/cells/" + FileName + "/documentProperties/" + propertyName; string signedURI = Utils.Sign(strURI); //serialize the JSON request content DocumentProperty docProperty = new DocumentProperty(); docProperty.Value = propertyValue; string strJSON = JsonConvert.SerializeObject(docProperty); Stream responseStream = Utils.ProcessCommand(signedURI, "PUT", strJSON); StreamReader reader = new StreamReader(responseStream); string strResponse = reader.ReadToEnd(); //Parse the json string to JObject JObject pJSON = JObject.Parse(strResponse); WorkbookResponse baseResponse = JsonConvert.DeserializeObject <WorkbookResponse>(pJSON.ToString()); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// Get Document's properties /// </summary> /// <returns>List of document properties</returns> public List <DocumentProperty> GetProperties() { try { //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 += "/documentProperties"; //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); //Create list of document properties List <Saaspose.Cells.DocumentProperty> properties = new List <Saaspose.Cells.DocumentProperty>(); //Deserializes the JSON to a object. WorkbookResponse docResponse = JsonConvert.DeserializeObject <WorkbookResponse>(parsedJSON.ToString()); properties = docResponse.DocumentProperties.DocumentPropertyList; //return document properties return(properties); } catch (Exception ex) { throw new Exception(ex.Message); } }
public void ProcessSmartMarker(string dataFile) { try { //build URI to get page count string strURI = Product.BaseProductUri + "/cells/" + FileName + "/smartmarker?xmlFile=" + dataFile; string signedURI = Utils.Sign(strURI); Stream responseStream = Utils.ProcessCommand(signedURI, "POST"); StreamReader reader = new StreamReader(responseStream); string strResponse = reader.ReadToEnd(); //Parse the json string to JObject JObject pJSON = JObject.Parse(strResponse); WorkbookResponse baseResponse = JsonConvert.DeserializeObject <WorkbookResponse>(pJSON.ToString()); } catch (Exception ex) { throw new Exception(ex.Message); } }