本文整理汇总了Java中com.aspose.storage.api.StorageApi类的典型用法代码示例。如果您正苦于以下问题:Java StorageApi类的具体用法?Java StorageApi怎么用?Java StorageApi使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StorageApi类属于com.aspose.storage.api包,在下文中一共展示了StorageApi类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.aspose.storage.api.StorageApi; //导入依赖的package包/类
public static void main(String... args) throws IOException {
// ExStart: get-particular-property
try {
// Instantiate Aspose Storage API SDK
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
CellsApi cellsApi = new CellsApi(Configuration.apiKey, Configuration.appSID, true);
String input = "sample1.xlsx";
Path inputFile = Utils.getPath(GetParticularProperty.class, input);
String propertyName = "Author";
storageApi.PutCreate(input, Utils.STORAGE, null, inputFile.toFile());
com.aspose.cells.model.CellsDocumentPropertyResponse apiResponse = cellsApi.GetDocumentProperty(input,
propertyName, Utils.STORAGE, null);
System.out.println(" Author : " + apiResponse.getDocumentProperty().getValue());
}
catch (Exception e) {
e.printStackTrace();
}
// ExEnd: get-particular-property
}
示例2: execute
import com.aspose.storage.api.StorageApi; //导入依赖的package包/类
public static void execute(Context context) throws IOException {
//ExStart: get-column-from-worksheet
try {
// Instantiate Aspose Storage API SDK
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
CellsApi cellsApi = new CellsApi(Configuration.apiKey, Configuration.appSID, true);
String input = "Sample1.xlsx";
File inputFile = Utils.stream2file("sample1","xlsx", context.getResources().openRawResource(R.raw.sample1));
String sheet = "Sheet1";
int index = 0;
storageApi.PutCreate(input, null, Utils.STORAGE, inputFile);
com.aspose.cells.model.ColumnResponse r = cellsApi
.GetWorksheetColumn("Sample1.xlsx", sheet, index, Utils.STORAGE, null);
System.out.println("Column: " + r.getColumn().getLink().getHref());
}
catch (Exception e) {
e.printStackTrace();
}
//ExEnd: get-column-from-worksheet
}
示例3: main
import com.aspose.storage.api.StorageApi; //导入依赖的package包/类
public static void main(String... args) throws IOException {
// ExStart: get-chart-legend
try {
// Instantiate Aspose Storage API SDK
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
CellsApi cellsApi = new CellsApi(Configuration.apiKey, Configuration.appSID, true);
String input = "Sample1.xlsx";
Path inputFile = Utils.getPath(GetChartLegend.class, input);
String sheet = "Sheet1";
int chartIndex = 0;
storageApi.PutCreate(input, null, Utils.STORAGE, inputFile.toFile());
com.aspose.cells.model.LegendResponse apiResponse = cellsApi.GetWorksheetChartLegend(input, sheet,
chartIndex, Utils.STORAGE, Utils.FOLDER);
System.out.println("Chart Legend Position :: " + apiResponse.getLegend().getPosition());
}
catch (Exception e) {
e.printStackTrace();
}
// ExEnd: get-chart-legend
}
示例4: main
import com.aspose.storage.api.StorageApi; //导入依赖的package包/类
public static void main(String[] args) {
String name = "SampleAttachment";
String fileName = name + ".pdf";
int attachmentIndex = 1;
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(GetAllBookmarksExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get specific attachment from a pdf
AttachmentResponse apiResponse = pdfApi.GetDocumentAttachmentByIndex(fileName, attachmentIndex, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
Attachment attach = apiResponse.getAttachment();
System.out.println("Name :: " + attach.getName());
System.out.println("MimeType :: " + attach.getMimeType());
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
示例5: execute
import com.aspose.storage.api.StorageApi; //导入依赖的package包/类
public static void execute(Context context) throws Exception {
//ExStart: AddCalendarToProjectExample
// Set input file name
String name = "sampleproject.mpp";
String fileName = null;
String storage = null;
String folder = null;
Calendar body = new Calendar();
body.setUid ( 0);
body.setName ( "TestCalender");
body.setIsBaseCalendar (true);
body.setIsBaselineCalendar ( false);
File input = Utils.stream2file("sample-project","mpp", context.getResources().openRawResource(R.raw.sampleproject));
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
TasksApi tasksApi = new TasksApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(name, "", "", input);
// Invoke Aspose.Tasks Cloud SDK API to add calendar to project
CalendarItemResponse apiResponse = tasksApi.PostProjectCalendar(name, fileName, storage, folder, body);
if (apiResponse != null)
{
System.out.println("Add Calendar to Project, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
//ExEnd: AddCalendarToProjectExample
}
示例6: main
import com.aspose.storage.api.StorageApi; //导入依赖的package包/类
public static void main(String[] args) {
// ExStart: 1
try {
// Instantiate Aspose Storage API SDK
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
WordsApi wordsApi = new WordsApi(Configuration.apiKey, Configuration.appSID, true);
// set destination file name
String fileName = "MathsObject.docx";
Path p1=Utils.getPath(SaveDocumentAsExample.class, fileName);
SaveOptions saveOptions = new SaveOptions();
saveOptions.setSaveFormat("bmp");
saveOptions.setFileName("Data.bmp");
saveOptions.setHorizontalResolution(700);
saveOptions.setVerticleResolution(400);
// upload source file to Aspose cloud storage
storageApi.PutCreate(fileName, "", "", p1.toFile());
// invoke Aspose.Words Cloud SDK API
SaveResponse apiResponse = wordsApi.PostDocumentSaveAs(fileName, null, null, saveOptions);
if (apiResponse != null && apiResponse.getStatus().equals("OK")) {
System.out.println("OK");
}
} catch (Exception e) {
e.printStackTrace();
}
// ExEnd: 1
}
示例7: execute
import com.aspose.storage.api.StorageApi; //导入依赖的package包/类
public static void execute(Context context) throws Exception {
//ExStart: 1
String fileName = "sample1-input.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
TextReplace body = new TextReplace();
body.setOldValue ( "Sample PDF");
body.setNewValue ( "Sample Aspose PDF");
File input = Utils.stream2file("input","pdf", context.getResources().openRawResource(R.raw.Sample_Annotation));
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", input);
// Invoke Aspose.PDF Cloud SDK API to replace text in a pdf page
PageTextReplaceResponse apiResponse = pdfApi.PostPageReplaceText(fileName, pageNumber, storage, folder, body);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Replace Text in a PDF Page, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
//ExEnd: 1
}
示例8: execute
import com.aspose.storage.api.StorageApi; //导入依赖的package包/类
public static void execute(Context context) throws Exception {
// ExStart: 1
try {
// Instantiate Aspose Storage API SDK
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
WordsApi wordsApi = new WordsApi(Configuration.apiKey, Configuration.appSID, true);
// set input file name
String fileName = "MathsObject.docx";
String storage = null;
String folder = null;
File input = Utils.stream2file("MathsObject","docx", context.getResources().openRawResource(R.raw.mathsobject));
// upload input file to aspose cloud storage
storageApi.PutCreate(fileName, "", "",input);
//Invoke the API
OfficeMathObjectsResponse apiResponse = wordsApi.GetOfficeMathObjects("MathsObject.docx", storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK")) {
System.out.println("Reading Math Objects Done");
}
} catch (Exception e) {
e.printStackTrace();
}
// ExEnd: 1
}
示例9: main
import com.aspose.storage.api.StorageApi; //导入依赖的package包/类
public static void main(String[] args) {
//ExStart: 1
String fileName = "sample-input.pptx";
String folder = "";
String storage = "";
Path inputFile = Utils.getPath(ExtractParticularShape.class, fileName);
try {
SlidesApi slidesApi = new SlidesApi(Configuration.apiKey, Configuration.appSID);
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.Slides Cloud SDK API to get number of images in a
// presentation
ImagesResponse apiResponse = slidesApi.GetSlidesSlideImages(fileName,1, folder, storage);
if (apiResponse != null) {
int count = apiResponse.getImages().getList().size();
System.out.println("Total Images Found :: " + count);
System.out.println("Get Number of Images in a Presentation, Done!");
}
} catch (Exception ex) {
ex.printStackTrace();
}
//ExEnd: 1
}
示例10: main
import com.aspose.storage.api.StorageApi; //导入依赖的package包/类
public static void main(String... args) throws IOException {
// ExStart: get-max-data-row
try {
// Instantiate Aspose Storage API SDK
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
CellsApi cellsApi = new CellsApi(Configuration.apiKey, Configuration.appSID, true);
String input = "sample1.xlsx";
Path inputFile = Utils.getPath(GetMaxDataRowWorksheet.class, input);
String sheetName = "Sheet1";
String cellOrMethodName = "maxdatarow";
storageApi.PutCreate(input, null, Utils.STORAGE, inputFile.toFile());
Integer apiResponse = cellsApi.GetWorksheetCellProperty(input, sheetName, cellOrMethodName, Utils.STORAGE,
Utils.FOLDER);
System.out.println(" MaxDataRow :: " + apiResponse);
}
catch (Exception e) {
e.printStackTrace();
}
// ExEnd: get-max-data-row
}
示例11: main
import com.aspose.storage.api.StorageApi; //导入依赖的package包/类
public static void main(String[] args) {
//ExStart: 1
// Set input file name
String name = "sample-project.mpp";
String storage = "";
String folder = "";
Integer taskUid = 1;
Path inputFile = Utils.getPath(RetrieveTaskInformationExample.class, name);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
TasksApi tasksApi = new TasksApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(name, "", "", inputFile.toFile());
// Invoke Aspose.Tasks Cloud SDK API to add task link to project
SaaSposeResponse apiResponse = tasksApi.GetTaskRecurringInfo(name,taskUid, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Get Recurring Information For Task Example, Done");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
//ExEnd: 1
}
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-Cloud,代码行数:31,代码来源:GetRecurringInformationForTaskExample.java
示例12: execute
import com.aspose.storage.api.StorageApi; //导入依赖的package包/类
public static void execute(Context context) throws IOException {
//ExStart: unmerge-cells-in-worksheet
try {
// Instantiate Aspose Storage API SDK
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
CellsApi cellsApi = new CellsApi(Configuration.apiKey, Configuration.appSID, true);
String input = "sample1.xlsx";
Path inputFile = Utils.getPath(UnmergeCellsWorksheet.class, input);
String output = "sample2.xlsx";
Path outputFile = Utils.getPath(UnmergeCellsWorksheet.class, output);
String sheetName = "Sheet1";
Integer startRow = 1;
Integer startColumn = 0;
Integer totalRows = 1;
Integer totalColumns = 5;
storageApi.PutCreate(input, null, Utils.STORAGE, inputFile.toFile());
cellsApi.PostWorksheetUnmerge(input, sheetName, startRow, startColumn, totalRows, totalColumns,
Utils.STORAGE, Utils.FOLDER);
com.aspose.storage.model.ResponseMessage sr = storageApi.GetDownload(input, null, Utils.STORAGE);
Files.copy(sr.getInputStream(), outputFile, StandardCopyOption.REPLACE_EXISTING);
}
catch (Exception e) {
e.printStackTrace();
}
//ExEnd: unmerge-cells-in-worksheet
}
示例13: main
import com.aspose.storage.api.StorageApi; //导入依赖的package包/类
public static void main(String... args) throws IOException {
// ExStart: protect-excel-workbook
try {
// Instantiate Aspose Storage API SDK
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
CellsApi cellsApi = new CellsApi(Configuration.apiKey, Configuration.appSID, true);
String input = "Sample1.xlsx";
String output = "Sample2.xlsx";
Path inputFile = Utils.getPath(ProtectWorkbook.class, input);
Path outputFile = Utils.getPath(ProtectWorkbook.class, output);
com.aspose.cells.model.WorkbookProtectionRequest properties = new com.aspose.cells.model.WorkbookProtectionRequest();
properties.setPassword("12345678");
properties.setProtectionType("All");
storageApi.PutCreate(input, Utils.STORAGE, null, inputFile.toFile());
cellsApi.PostProtectDocument(input, Utils.STORAGE, null, properties);
com.aspose.storage.model.ResponseMessage sr = storageApi.GetDownload(input, null, Utils.STORAGE);
Files.copy(sr.getInputStream(), outputFile, StandardCopyOption.REPLACE_EXISTING);
} catch (Exception e) {
e.printStackTrace();
}
// ExEnd: protect-excel-workbook
}
示例14: execute
import com.aspose.storage.api.StorageApi; //导入依赖的package包/类
public static void execute(Context context) throws Exception{
//ExStart: 1
String fileName = "sampleinput.pptx";
int slideIndex = 1;
String folder = "";
String storage = "";
File inputFile = Utils.stream2file("sample-input","pptx", context.getResources().openRawResource(R.raw.sampleinput));
try
{
SlidesApi slidesApi = new SlidesApi(Configuration.apiKey, Configuration.appSID);
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "",inputFile);
// Invoke Aspose.Slides Cloud SDK API to get placeholder count from a slide
PlaceholdersResponse apiResponse = slidesApi.GetSlidesPlaceholders(fileName, slideIndex, folder, storage);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
int placeholderCount = apiResponse.getPlaceholders().getPlaceholderLinks().size();
System.out.println("PlaceholderCount :: " + placeholderCount);
System.out.println("Get Placeholder Count from a PowerPoint Slide, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
//ExEnd: 1
}
示例15: execute
import com.aspose.storage.api.StorageApi; //导入依赖的package包/类
public static void execute(Context context) throws IOException {
//ExStart: merge-cells-worksheet
try {
// Instantiate Aspose Storage API SDK
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
CellsApi cellsApi = new CellsApi(Configuration.apiKey, Configuration.appSID, true);
String input = "sample1.xlsx";
File inputFile = Utils.stream2file("sample1","xlsx", context.getResources().openRawResource(R.raw.sample1)); String output = "sample2.xlsx";
File outputFile = Utils.stream2file("sample2","xlsx", context.getResources().openRawResource(R.raw.sample2));
String sheetName = "Sheet1";
Integer startRow = 1;
Integer startColumn = 0;
Integer totalRows = 1;
Integer totalColumns = 5;
storageApi.PutCreate(input, null, Utils.STORAGE, inputFile);
cellsApi.PostWorksheetMerge(input, sheetName, startRow, startColumn, totalRows, totalColumns, Utils.STORAGE,
Utils.FOLDER);
com.aspose.storage.model.ResponseMessage sr = storageApi.GetDownload(input, null, Utils.STORAGE);
}
catch (Exception e) {
e.printStackTrace();
}
//ExEnd: merge-cells-worksheet
}