A fagen gudanar da ayyuka, nasara ta ta’allaka ne akan ikon samun dama, tantancewa, da aiki akan bayanan aikin ku yadda ya kamata. Fayilolin MPP su ne rayuwar masu gudanar da ayyuka, suna ɗauke da mahimman bayanai waɗanda ke tafiyar da yanke shawara. Koyaya, buƙatar raba, haɗin gwiwa, da kuma nazarin wannan bayanan galibi yana buƙatar canji daga MPP zuwa ingantaccen tsari kamar Excel. Wannan jujjuyawar yana baiwa manajojin aikin damar yin amfani da ƙarfin ikon sarrafa bayanai na Excel, yana sa bayanan aikin ya zama mai sauƙi da aiki.
A cikin wannan labarin, mun zurfafa cikin mahimman buƙatu da fa’idodin da ba za a iya musantawa ba na canza MPP zuwa Excel, ta amfani da Java Cloud SDK.
API ɗin Java REST don Canjin Fayilolin Ayyukan Microsoft
Aspose.Tasks Cloud SDK for Java yana ba ku damar cike gibin da ke tsakanin fayilolin MPP da maƙunsar bayanai na Excel. Ko kuna sarrafa ayyuka, jerin lokaci, albarkatu, ko kasafin kuɗi, wannan jujjuyawar tana buɗe yuwuwar haƙon bayanai masu inganci da bincike. Hakanan] yana ba da damar ƙirƙira, sarrafa da fitarwa fayil ɗin Microsoft Project zuwa Excel, HTML, JPEG, PDF, XML, [PNG] 8] Formats.
Don amfani da SDK, zaku iya zazzage [aspose-tasks-cloud.jar] kai tsaye 9 ko ƙara wannan magana zuwa pom.xml a cikin nau’in ginin 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-tasks-cloud</artifactId>
<version>21.10.0</version>
</dependency>
</dependencies>
Bugu da ƙari, mataki na gaba don amfani da SDK shine yin rijistar asusu akan Aspose.Cloud dashboard ta amfani da GitHub ko asusun Google ko kawai Yi rajista don samun Shaidar Abokin Ciniki na ku.
Canza Fayil na MPP zuwa Excel a cikin Java
Bari mu bincika cikakkun bayanai kan yadda za mu iya loda fayil ɗin MPP daga ma’ajin gajimare da fitar da MS Project don yin fice a cikin aikace-aikacen Java.
- Da farko, ƙirƙiri misalin aji na ApiClient yayin wucewa ID ɗin abokin ciniki da Sirrin Abokin ciniki azaman mahawara
- Na biyu, ƙirƙirar abu na TasksApi wanda ke ɗaukar abin ApiClient azaman hujja
- Na uku, ƙirƙiri wani abu na UploadFileRequest wanda ke ɗaukar sunan shigar fayil MPP azaman hujja
- Kira Hanyar UploadFile(…) don loda fayil ɗin MPP zuwa ma’ajiyar gajimare
- Mataki na gaba shine aiwatar da wani abu na GetTaskDocumentWithFormatRequest inda muka samar da sunan shigar da fayil MPP da XLSX azaman tsarin fitarwa.
- A ƙarshe, kira hanyar getTaskDocumentWithFormat(…) don canza fayil ɗin MPP zuwa Excel kuma adana fitarwa zuwa ma’ajin girgije.
// Don cikakkun misalai da fayilolin bayanai, da fatan za a je zuwa https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-java
// Samu bayanan abokin ciniki daga https://dashboard.aspose.cloud/
try {
// idan baseUrl ba shi da amfani, TasksApi yana amfani da tsoho https://api.aspose.cloud
// ƙirƙiri wani abu na ApiClient ta amfani da bayanan abokin ciniki
ApiClient apiClient = new ApiClient("bbf94a2c-6d7e-4020-b4d2-b9809741374e", "1c9379bb7d701c26cc87e741a29987bb", null);
// ƙirƙiri misali na TasksApi yayin wucewa ApiClient abu azaman hujja
TasksApi tasksApi = new TasksApi(apiClient);
// shigar da fayil MPP daga faifan gida
String localPath = "C:\\Users\\Home move plan(1).mpp";
// ƙirƙiri wani abu na UploadFileRequest yayin samar da fayil MPP shigarwa azaman mahawara
UploadFileRequest uploadRequest = new UploadFileRequest("source.mpp", new java.io.File(localPath), null);
// kira hanyar don loda fayil ɗin MPP zuwa ma'ajin gajimare
tasksApi.uploadFile(uploadRequest);
// ƙirƙiri wani abu na sauya fayilolin MPP yayin tantance tsarin fitarwa azaman XLSX
GetTaskDocumentWithFormatRequest request = new GetTaskDocumentWithFormatRequest("source.mpp","XLSX",false,null, null);
// kira API don canza fayil ɗin aikin Microsoft zuwa tsarin Excel
File result = tasksApi.getTaskDocumentWithFormat(request);
// buga sunan resultant excel a cikin na'ura mai kwakwalwa
System.out.println(result.getName());
System.out.println("The conversion has been successful !");
}catch (Exception ex)
{
System.out.println(ex.getStackTrace());
}
Fitar da Fayil na Ayyukan Microsoft zuwa Excel ta amfani da Umarnin CURL
A cikin wannan sashe, za mu yi amfani da umarnin cURL don fitarwa Fayil ɗin Ayyukan Microsoft zuwa tsarin Excel. Ana zazzage fayil ɗin sakamako zuwa faifan gida. Koyaya, kafin mu fara aikin juyawa, muna buƙatar samar da alamar samun damar JWT dangane da shaidar abokin ciniki. Da fatan za a aiwatar da umarni mai zuwa a cikin aikace-aikacen tashar don samar da alamar JWT:
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=bbf94a2c-6d7e-4020-b4d2-b9809741374e&client_secret=1c9379bb7d701c26cc87e741a29987bb" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
Yanzu da muke da alamar, da fatan za a aiwatar da wannan umarni don canza fayil ɗin MPP da ke cikin ma’ajiyar gajimare zuwa tsarin Excel.
curl -v -X GET "https://api.aspose.cloud/v3.0/tasks/source.mpp/format?format=xlsx&returnAsZipArchive=false" \
-H "accept: multipart/form-data" \
-H "authorization: Bearer <JWT Token>" \
-o Converted.xlsx
Za a iya sauke fayil ɗin MPP ɗin shigarwa da aka yi amfani da shi a cikin misalin da ke sama daga Homemoveplan.mpp kuma za a iya saukar da sakamakon excel daga Converted.xlsx.
Kammalawa
Wannan labarin ya bayyana matakan canza fayil ɗin MPP zuwa tsarin Excel ta amfani da Java Cloud SDK. Mun lura cewa tare da kiran API guda ɗaya, ana yin duka jujjuyawar kuma mun kuma bincika sauƙin fitarwa fayil ɗin aikin Microsoft zuwa tsari mai kyau ta amfani da umarnin cURL akan tashar layin umarni. Bugu da ƙari, ana samun cikakkiyar lambar tushen SDK akan GitHub kuma kuna iya gyara ta gwargwadon buƙatun ku.
Labarai masu alaka
Muna ba da shawarar ziyartar hanyoyin haɗin yanar gizon don koyo game da su