Tuesday, April 29, 2014

Protect Excel Workbooks (Data, Content & Formatting) Using Cloud APIs

This technical tip shows how developers can protect MS Excel workbooks using Aspose.Cells for Cloud API inside their own cloud applications. When a worksheet is protected, user's actions are restricted. For example, you cannot input data. Moreover, you can't insert or delete rows or columns etc. There are mostly 3 protection options in MS Excel, such as protecting Contents, Objects or Scenarios.  Protected worksheet doesn't hide or protect sensitive data, so it's different from file encryption. Generally, worksheet protection is suitable for presentation purposes. It prevents the end users from modifying the data, content and formatting in the worksheet. Developers can use Aspose REST API with any language for their choice such as .NET, Java, PHP, Ruby, Rails, Python, jQuery and many more.

Please take a look over the following code snippet for Protecting Excel Workbooks
 [C#]
//build URI
string strURI = "http://api.aspose.com/v1.1/cells/input.xls/protection"

string signedURI = Sign(strURI);
//serialize the JSON request content
Protection protection = new Protection();
protection.ProtectionType = protectionType;
protection.Password = password;

string strJSON = JsonConvert.SerializeObject(protection);
Stream responseStream = ProcessCommand(signedURI, "POST", strJSON);
StreamReader reader = new StreamReader(responseStream);
string strResponse = reader.ReadToEnd();

//Parse the json string to JObject
JObject pJSON = JObject.Parse(strResponse);

//Here is the Protection Class used above
public class Protection
{
    public Protection()
    {

    }
    public ProtectionType ProtectionType { get; set;}
    public string Password { get; set;}

}
/// <summary>
/// Represents Protection Types
/// </summary>
public enum ProtectionType
{
    All,
    Structure,
    Windows,
    None
}


[Java Code]

AsposeApp.setAppSID("77******-1***-4***-a***-8***********");
AsposeApp.setAppKey("89******************************");

//build URI to Protect Workbook
string strURI = "http://api.aspose.com/v1.1/cells/input.xls/protection";

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

//serialize the JSON request content
Protection protection = new Protection();
protection.setProtectionType(ProtectionType.All);
protection.setPassword("password");

String strJSON = "";
Gson gson = new Gson();
strJSON = gson.toJson(encryption, Encryption.class);
InputStream responseStream = ProcessCommand(signedURI, "POST", strJSON);
String strResponse = StreamToString(responseStream);
//Following is the Protection Class used above
public class Protection
    {
        public Protection()
        {

        }
        private ProtectionType ProtectionType;
        private String Password;

        public ProtectionType getProtectionType(){return ProtectionType;}
        public String getPassword(){return Password;}

        public void setProtectionType(ProtectionType ProtectionType){ this.ProtectionType=ProtectionType;}
        public void setPassword(String Password ){ this.Password=Password;}

    }
    /// <summary>
    /// Represents Protection Types
    /// </summary>
    public enum ProtectionType
    {
        All,
        Structure,
        Windows,
        None
    }


[PHP Code]

AsposeApp::$appSID = "77******-1***-4***-a***-80**********";
AsposeApp::$appKey = "********************************";

AsposeApp::$outPutLocation = getcwd() . "/Output/";
//build URI to protect workbook
$strURI = 'http://api.aspose.com/v1.1/cells/Sample.xlsx/protection';

//Build JSON to post
$fieldsArray["ProtectionType"] = "all";
$fieldsArray["Password"] = "abc";
$json = json_encode($fieldsArray);

$signedURI = Utils::sign($strURI);
$responseStream = Utils::processCommand($signedURI, "POST", "json", $json);
//Download output file
$strURI = "http://api.aspose.com/v1.1/storage/file/Sample.xlsx";
$signedURI = Utils::sign($strURI);

$responseStream = Utils::processCommand($signedURI, "GET", "", "");
Utils::saveFile($responseStream, AsposeApp::$outPutLocation . "Sample.xlsx");


Overview: Aspose for Cloud
Aspose for Cloud is a cloud-based document generation, conversion and automation platform for developers that offer a unique suite of APIs to work with Word documents, Excel spreadsheets, PowerPoint presentations, PDFs, and email formats and protocols. It supports all features for file processing, document scanning, barcodes creation and recognition, and allows extracting text or images too. You can also work with SaaSpose APIs using REST SDKs that can be called from .NET, Java, PHP and Ruby etc.

Wednesday, April 23, 2014

Add, Update or Delete Excel Charts and Chart Legends Using Cloud APIs

What's New in this Release?
We are pleased to announce the release of Aspose for Cloud 1.1.6.6. With this release create, read, manipulate and export features are greatly improved. You can add or delete Microsoft Excel charts and read, show, hide or update chart legends. Some bugs have also been fixed. Below are lists of enhancements by API.
  • Add Charts – This feature allows you to add a new chart in a worksheet. The charts resource can be used and a PUT request can be sent (specifying data for chart series and other chart options) to add a new chart.
  • Delete Charts – This feature allows you to delete all charts from a worksheet. The charts resource can be used and a DELETE request can be sent to delete all charts.
  • Show Chart Legend – This feature allows you to show a chart legend on a chart in a worksheet. The legend resource can be used and a PUT request can be sent to show chart legend.
  • Hide Chart Legend – This feature allows you to hide a chart legend in a worksheet. The legend resource can be used and a DELETE request can be sent to hide chart legend.
  • Update Chart Legend – This feature allows you to update a chart legend on a chart in a worksheet. The legend resource can be used and a POST request can be sent (specifying updated values in the request body) to update chart legend.
  • Read Chart Legend – This feature allows you to read information of a chart legend from a worksheet. The legend resource can be used and a GET request can be sent for this purpose.
  • Aspose.Slides for Cloud’s codebase has been updated to improve Microsoft PowerPoint presentation conversion to PDF and fix some rendering bugs.
  • A bug related to sign up using a Facebook account has been fixed.
Newly added documentation pages and articles
Some new tips and articles have now been added into Aspose for Cloud documentation that may guide you briefly how to use Aspose for Cloud for performing different tasks like the followings.
Overview: Aspose for Cloud
Aspose for Cloud is a cloud-based document generation, conversion and automation platform for developers that offer a unique suite of APIs to work with Word documents, Excel spreadsheets, PowerPoint presentations, PDFs, and email formats and protocols. It supports all features for file processing, document scanning, barcodes creation and recognition, and allows extracting text or images too. You can also work with SaaSpose APIs using REST SDKs that can be called from .NET, Java, PHP and Ruby etc.
More about Aspose for Cloud
Contact Information
Aspose Pty Ltd, Suite 163,
79 Longueville Road
Lane Cove, NSW, 2066
Australia
Aspose - Your File Format Experts 2.0
sales@aspose.com
Phone: 888.277.6734
Fax: 866.810.9465

Wednesday, April 9, 2014

Add, Delete, Update Pictures & OLE Objects in Excel Worksheet Using PHP SDK

What's New in this Release?

We are pleased to announce the release of Aspose for Cloud PHP SDK as per Aspose for Cloud 1.1.6.5. With this new release, the create, read, manipulate and export features are greatly improved. You can add, update or delete pictures and OLE objects, and set different options including auto-fit rows when saving Microsoft Excel workbooks as other formats. Here are some of these features
  • Add OleObject – Add a new OLE object to a Microsoft Excel worksheet. The oleobjects resource can be used and a PUT request can be sent (specifying options for OLE object) to add a new OLE object.
  • Update OleObject – Update a specific OLE object in a worksheet. The oleobject resource can be used and a POST request can be sent (specifying options to update) to update an existing OLE object.
  •  Delete OleObject – Delete an existing OLE object from a worksheet. The oleobject resource can be used and a DELETE request can be sent to delete a specific object.
  •  Delete all OleObjects – Delete all OLE objects from a worksheet. The oleobjects resource can be used and a DELETE request can be sent to delete all OLE objects.
  • Add a Picture – Add a new picture to a worksheet. The pictures resource can be used and a PUT request can be sent (specifying options for picture) to add a new picture.
  • Update a Picture – Update a specific picture in a worksheet. The picture resource can be used and a POST request can be sent (specifying options to update) to update an existing picture.
  • Delete a Picture – Delete an existing picture from a worksheet. The picture resource can be used and a DELETE request can be sent to delete a specific picture.
  • Delete all Pictures – Delete all pictures from a worksheet. The pictures resource can be used and a DELETE request can be sent to delete all pictures.
  • Convert PDFs from Remote Server – Convert Adobe Acrobat PDF files uploaded to a remote server. You can pass URL and format parameters to specify the PDF’s URL and output format and use the PUT method of the convert resource to convert remote PDF files.
Overview: Aspose for Cloud

Aspose for Cloud is a cloud-based document generation, conversion and automation platform for developers that offer a unique suite of APIs to work with Word documents, Excel spreadsheets, PowerPoint presentations, PDFs, and email formats and protocols. It supports all features for file processing, document scanning, barcodes creation and recognition, and allows extracting text or images too. You can also work with SaaSpose APIs using REST SDKs that can be called from .NET, Java, PHP and Ruby etc.