Important alert: (current site time 11/26/2014 12:54:38 AM EDT)
 

article

Split Excel Doc & Save Each Worksheet as PDF, Image at Amazon S3 Storage

Email
Submitted on: 2/12/2013 2:32:34 PM
By: Saaspose 
Level: Intermediate
User Rating: Unrated
Compatibility: PHP 4.0, PHP 5.0
Views: 4085
(About the author)
 
     This technical tip allows developers to split all or specific pages of an Excel document and save each worksheet as PDF, Image or any supported format using Saaspose.Cells REST API in your PHP 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 to split all or specific pages of an Excel document and save each worksheet as PDF, Image or any supported format using Saaspose.Cells REST API in your PHP applications. Input Excel documents need to be uploaded at Amazon S3 Storage before running this code. You need to configure Amazon S3 Storage with Saaspose before using this example. Some important steps for performing this task are to build URI to split sheets, sign URI, iterate through each document in the result to find output sheets, build URI to download split sheets And save split PDF pages.
Sample Code for Splitting Excel Documents at Amazon S3 Storage
SaasposeApp::$AppSID = "77***********************************";
SaasposeApp::$AppKey = "9a*******************************";
SaasposeApp::$OutPutLocation = getcwd() . "\\Output\\";
$AmazonS3StorageName = "AmazonS3Storage";
$AmazonS3BucketName = "Saaspose";
$AmazonS3Folder = $AmazonS3BucketName . "/Folder1"; // use $AmazonS3Folder = $AmazonS3BucketName for root folder
//build URI to split sheets
$strURI = 'http://api.saaspose.com/v1.0/cells/Sample1.xlsx/split?format=png&storage=' . $AmazonS3StorageName . '&folder=' . $AmazonS3Folder; 
//sign URI
$signedURI = Utils::Sign($strURI);
$responseStream = Utils::processCommand($signedURI, "POST", "", "");
$json = json_decode($responseStream);
//iterate throug each document in the result to find output sheets
foreach ($json->Result->Documents as $splitSheet) { 
	$splitFileName = $splitSheet->link->Href;
	
	//build URI to download split sheets 
	$strURI = 'http://api.saaspose.com/v1.0/storage/file/'. $AmazonS3Folder . '/' . $splitFileName . '?storage=' . $AmazonS3StorageName;
	
	//sign URI
	$signedURI = Utils::Sign($strURI);
	$responseStream = Utils::processCommand($signedURI, "GET", "", "");
	//save split PDF pages
	$outputFile = SaasposeApp::$OutPutLocation . $splitFileName;
	Utils::saveFile($responseStream, $outputFile);
}
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 
- Configure Amazon S3 Storage with Saaspose: http://saaspose.com/docs/display/rest/Amazon+S3+Storage 
- Ask technical questions/queries from Saaspose Support Team: http://saaspose.com/support/contact-us
Contact Information
Aspose Pty Ltd, Suite 163, 
79 Longueville Road
Lane Cove, NSW, 2066 
Australia 
http://www.saaspose.com/
sales@saaspose.com 
Phone: 1.214.329.1520
Fax: 866.810.9465


Other 1 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


 There are no comments on this submission.
 

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.