Important alert: (current site time 7/29/2014 2:19:03 AM EDT)
 

article

Protect Excel Workbook from Unauthorized Access in Java Applications

Email
Submitted on: 1/30/2013 10:37:26 AM
By: Saaspose 
Level: Intermediate
User Rating: Unrated
Compatibility: Java (JDK 1.3), Java (JDK 1.4), Java (JDK 1.5)
Views: 8614
(About the author)
 
     This technical tip allows developers how to protect a Excel workbook from unauthorized access using Saaspose.Cells REST API in Java applications.

 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
  1. You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
				This technical tip allows developers how to protect a Excel workbook from unauthorized access using Saaspose.Cells REST API in Java applications. Some important steps for performing this task is to build URI to Protect Workbook, sign URI, serialize the JSON request content, Represents Protection Types and use Protection Class above to apply the protection.
Sample Code for protecting Excel workbook from unauthorized access
//build URI to Protect Workbook
string strURI = "http://api.saaspose.com/v1.0/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;}
}
/// 
/// Represents Protection Types
/// 
public enum ProtectionType
{
All,
Structure,
Windows,
None
}
More about Saaspose.Cells
- Homepage of Saaspose.Cells: http://saaspose.com/api/cells 
 
- More Technical Tips by Saaspose.Cells: http://saaspose.com/docs/display/cells/1.2+-+Saaspose.Cells+Examples 


Other 2 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Intermediate category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

8/30/2013 2:53:58 AMaspose_seo

Hi, Please note that Saaspose is rebranded as “Aspose for Cloud”.  Here is the blog post announcing the change. To download and view detail information about the products please visit Aspose Cloud APIs page. Thanks
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.