SXC ya kasance tsohuwar tsarin fayilolin da aka ƙirƙira a cikin software na Calc na StarOffice suite. Waɗannan fayilolin sun ƙunshi maƙunsar bayanai masu goyan bayan ƙididdiga, ayyuka, macros da sigogi, da kuma ginshiƙi na DataPilot wanda zai iya keɓanta kai tsaye da samar da taƙaitaccen bayanan da aka shigo da su. StarOffice an ɗan san shi da Oracle Open Office kafin a dakatar da shi a cikin 2011, ɗakin ofis ne na mallakar mallaka. Fayilolin SXC sun dace da sauran suites na ofis watau Apache OpenOffice, LibreOffice, IBM Lotus Symphony, NeoOffice da dai sauransu. Amma tunda an daina StarOffice, don haka ana iya samun ƙungiyoyi waɗanda har yanzu suna da takaddun gadonsu iri ɗaya. Athwart, a yanzu kwanaki, muna amfani da yawa Excel takardun aiki a maimakon buɗe excel ofis ko buɗaɗɗen ma’auni na ofis. Yana ba da wasu iyakoki masu ban mamaki don sarrafawa, tantancewa da gabatar da bayanai cikin tsari mai ma’ana. Don haka, fayilolin Excel sun zama daidai da mahimmanci ga kasuwanci da kuma amfanin mutum. Don haka a cikin wannan labarin, za mu koyi matakai kan yadda ake canza SXC zuwa Excel ta amfani da REST API.
- API ɗin Canjin SXC zuwa Excel
- Fitar da SXC zuwa Excel - Ma’ajiyar Gida
- Bude Office Excel zuwa XLS ta amfani da Java
- Fitar da Buɗaɗɗen Fayil ɗin Fayil ɗin Office zuwa Excel ta amfani da Umarnin CURL
API ɗin Canjin SXC zuwa Excel
Mu Aspose.Cells Cloud SDK don Java ya shahara sosai don ƙirƙirar takaddun aiki na Excel, magudi da canzawa zuwa nau’ikan nau’ikan nau’ikan nau’ikan tsarin Java. Don haka tare da ƴan layukan lamba, kuna samun zaɓi don lodawa da canza shahararrun tsarin aikin daftarin aiki da juyawa zuwa wani tsarin da ake so. Yanzu don farawa da amfani da shi, da fatan za a ƙara cikakkun bayanai masu zuwa a cikin pom.xml na aikin gina nau’in maven.
<repositories>
<repository>
<id>aspose-cloud</id>
<name>artifact.aspose-cloud-releases</name>
<url>https://artifact.aspose.cloud/repo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-cells-cloud</artifactId>
<version>22.8</version>
</dependency>
</dependencies>
Da zarar an ƙara bayanin SDK, muna buƙatar ƙirƙirar asusun kyauta akan Aspose Cloud. Shiga ta amfani da sabon asusun da aka ƙirƙira kuma bincika/ƙirƙiri ID na abokin ciniki da Sirrin Abokin ciniki a Cloud Dashboard. Ana buƙatar waɗannan cikakkun bayanai a cikin sassan da ke gaba.
Fitar da SXC zuwa Excel - Ma’ajiyar Gida
A cikin wannan sashe, za mu tattauna cikakkun bayanai kan yadda ake canza Excel zuwa JSON ba tare da fara loda shigarwar Excel zuwa ajiyar girgije ba. Koyaya, sakamakon JSON za a adana shi a cikin ma’ajin gajimare.
- Da farko, ƙirƙiri abin CellsApi yayin samar da ClientID da bayanan sirri na Abokin ciniki azaman muhawara
- Na biyu, ƙirƙirar misalin Fayil don loda tushen fayil ɗin SXC
- Sannan kira hanyar selWorkbookPutConvertWorkbook(…) da ke buƙatar shigar da sunan fayil na SXC, tsarin sakamako azaman XLS da sunan fayil ɗin fitarwa. Bayan nasarar yin nasara, za a adana fayil ɗin XLS a cikin ma’ajin gajimare
// don ƙarin misalai, da fatan za a ziyarci https://github.com/aspose-cells-cloud/aspose-cells-cloud-java
try
{
// Samu ClientID da ClientSecret daga https://dashboard.aspose.cloud/
String clientId = "bb959721-5780-4be6-be35-ff5c3a6aa4a2";
String clientSecret = "4d84d5f6584160cbd91dba1fe145db14";
// ƙirƙiri misali na CellsApi ta amfani da takaddun shaidar abokin ciniki
CellsApi api = new CellsApi(clientId,clientSecret);
// sunan shigarwar Fayil ɗin Ƙimar Raba Tab
String fileName = "source.sxc";
// bayanan sirri idan littafin aiki a rufaffen
String password = null;
// loda fayil daga tsarin gida
File file = new File("/Users/nayyer/"+fileName);
// yi aikin canza takarda
api.cellsWorkbookPutConvertWorkbook(file, format, password, "output.xls", "default", null);
// buga sakon nasara
System.out.println("Successsul conversion of Open Office Spreadsheets (SXC) to Excel !");
}catch(Exception ex)
{
System.out.println(ex.getMessage());
}
Bude Office Excel zuwa XLS ta amfani da Java
Har ila yau, muna da damar loda Open office Excel (SXC) daga ma’ajiyar gajimare da yin juzu’i zuwa Excel (XLS, XLSX da sauransu). Don haka ko dai na iya loda duk wani fayil ɗin da ke akwai ko loda shi da farko kuma a yi la’akari da shi yayin aikin juyawa. Tare da wannan hanyar, ana kuma adana fayil ɗin sakamako a cikin ma’ajin gajimare.
- Da farko, ƙirƙiri abin CellsApi yayin samar da ClientID da bayanan sirri na Abokin ciniki azaman muhawara
- Na biyu, ƙirƙiri misalin Fayil don loda shigar da littafin aikin SXC
- Yanzu kira hanyar uploadFile(…) don loda fayil ɗin SXC zuwa ma’ajiyar gajimare
- A ƙarshe, kira tsarin cellWorkbookGetWorkbook(…) wanda ke buƙatar sunan shigar da fayil ɗin SXC, tsarin sakamako kamar XLS da sunan sa. Bayan jujjuyawar, ana adana fitarwa a cikin ma’ajin gajimare.
// don ƙarin misalai, da fatan za a ziyarci https://github.com/aspose-cells-cloud/aspose-cells-cloud-java
try
{
// Samu ClientID da ClientSecret daga https://dashboard.aspose.cloud/
String clientId = "bb959721-5780-4be6-be35-ff5c3a6aa4a2";
String clientSecret = "4d84d5f6584160cbd91dba1fe145db14";
// ƙirƙiri misali na CellsApi ta amfani da takaddun shaidar abokin ciniki
CellsApi api = new CellsApi(clientId,clientSecret);
// sunan shigarwar Fayil ɗin Ƙimar Raba Tab
String fileName = "source.sxc";
// bayanan sirri idan littafin aiki a rufaffen
String password = null;
// Yana ƙayyade ko saita layuka na littafin aiki don zama autofit.
Boolean isAutoFit = true;
// Yana ƙayyade ko ajiye bayanan tebur kawai. Ana amfani da shi kawai a cikin PDF don Excel.
Boolean onlySaveTable = true;
// resultant fayil format
String format = "XLS";
// karanta SXC fayil daga tsarin gida
File file = new File("/Users/nayyer/"+fileName);
// loda tushen SXC zuwa ma'ajiyar gajimare
api.uploadFile("source.sxc", file, "default");
// yi aikin canza takarda
api.cellsWorkbookGetWorkbook("source.sxc", password, format,
isAutoFit, onlySaveTable, null,"default", "Output.xls","default", null);
// buga sakon nasara
System.out.println("Successsul conversion of Open Office Spreadsheets (SXC) to Excel !");
}catch(Exception ex)
{
System.out.println(ex.getMessage());
}
Don bayanin ku, an raba tushen SXC da sakamakon XLS akan source.sxc da fitarwa.xls
Fitar da Buɗaɗɗen Fayil ɗin Fayil ɗin Office zuwa Excel ta amfani da Umarnin CURL
Tunda ana iya samun dama ga REST APIs ta hanyar umarnin cURL, don haka a cikin wannan sashe, za mu kira Aspose.Cells Cloud ta umarnin cURL don cika abin da muke bukata. Yanzu ɗayan abubuwan da ake buƙata don wannan aikin shine samar da alamar samun damar JWT (dangane da shaidar abokin ciniki) yayin aiwatar da umarni mai zuwa.
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=bb959721-5780-4be6-be35-ff5c3a6aa4a2&client_secret=4d84d5f6584160cbd91dba1fe145db14" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
Yanzu da zarar mun sami alamar JWT, muna buƙatar aiwatar da umarni mai zuwa don canza buɗaɗɗen maƙunsar bayanai zuwa XLS. Za a adana sakamakon XLS a cikin ma’ajin gajimare.
curl -v -X GET "https://api.aspose.cloud/v3.0/cells/source.sxc?format=XLS&isAutoFit=false&onlySaveTable=false&outPath=output.xls&checkExcelRestriction=true" \
-H "accept: application/json" \
-H "authorization: Bearer <JWT Token>"
Kammalawa
Wannan labarin ya bayyana jujjuyawar buɗaɗɗen maɓalli na Office (SXC) zuwa XLS, XLSX da dai sauransu ta amfani da snippet code na Java. Hakazalika, mun kuma bincika wani zaɓi na juya SXC zuwa Excel ta amfani da umarnin cURL yayin aiwatar da su akan tashar layin umarni. Kuna iya lura da wani kyakkyawan yanayin canza Open Office Excel (SXC) zuwa XLS shine cewa an rage girman wannan sabon fayil ɗin. Lura cewa duk Cloud SDK ɗin mu an gina su ƙarƙashin lasisin MIT, don haka ana iya sauke cikakkiyar lambar tushe daga GitHub. Kuna iya la’akari da kusantar mu don saurin warware batutuwa ta hanyar kyauta Tallafin tallafin samfur.
Labarai masu alaka
Muna ba da shawarar ziyartar hanyoyin haɗin yanar gizo masu zuwa don ƙarin koyo game da: