A cikin duniyar sarrafa ayyukan, sassauci da inganci sune mahimmanci. Idan ya zo ga sarrafa fayilolin Project na Microsoft (MPP) da canza su zuwa littattafan aikin Excel (XLS ko XLSX), tsarin zai iya zama wasa- mai canzawa. Canza fayilolin Microsoft Project (MPP) zuwa Excel ([XLS] (https://docs.fileformat.com/spreadsheet/xls/) ko [XLSX] (https://docs.fileformat.com/spreadsheet/xlsx/)) yana fitar da fa’idodi da yawa waɗanda zasu iya haɓaka iyawar sarrafa ayyukan ku. Ko don ingantacciyar rahoto, rabawa, ko ƙarin bincike, buƙatar fitar da bayanan aikin MS zuwa Excel buƙatun gama gari ne. Wannan labarin ya fara tafiya don bincika hanyoyi masu sauƙi amma masu ƙarfi don canza MPP zuwa Excel ta amfani da NET REST API.
- API ɗin REST don MPP zuwa Canjin Excel
- Maida MPP zuwa XLSX tare da C# .NET
- Maida MPP zuwa Excel tare da Umarnin CURL
API ɗin REST don MPP zuwa Canjin Excel
Canjin MPP zuwa Excel yana zama iska lokacin da kuke amfani da ikon Aspose.Tasks Cloud SDK don NET. Wannan madaidaicin kayan aikin yana ba da cikakkiyar bayani don canza fayilolin aikin Microsoft ɗinku ba tare da matsala ba (MPP) zuwa littattafan aiki na Excel (XLS ko XLSX) ba tare da wahalar shigarwa ko tsara bayanan hannu ba. Bugu da ƙari, SDK kuma yana tabbatar da cewa MPP ɗinku zuwa fassarar Excel daidai ne, inganci, kuma ana iya samun dama daga ko’ina. Don haka, bari mu shiga cikin iyawar wannan SDK kuma mu ba da ƙarfin ƙoƙarin gudanar da ayyukan ku tare da canza MPP zuwa Excel.
Domin amfani da SDK a cikin aikinku, da fatan za a bincika ‘Aspose.Tasks-Cloud’ a cikin manajan fakitin NuGet kuma danna maɓallin ‘Ƙara Kunshin’. Wannan zai ƙara bayanin SDK a cikin aikin ku. Abu na biyu, sami takaddun shaidar abokin cinikin ku daga cloud dashboard.
Idan ba ku da asusu, kawai ƙirƙiri asusun kyauta ta bin umarnin da aka kayyade akan saurin farawa.
Maida MPP zuwa XLSX tare da C# .NET
Yi shiri don buɗe yuwuwar canjin MPP zuwa Excel kuma ku shaida canjin sarrafa bayanan aikin ku ta amfani da C# .NET.
An ba da ƙasa akwai cikakkun bayanai masu sauri game da snippet code wanda zai iya taimaka mana mu fitar da MS Project zuwa littafin aikin Excel.
TasksApi tasksApi = new TasksApi(clientSecret, clientID);
Ƙirƙiri wani abu na ajin TasksApi yayin wucewa da bayanan abokin ciniki azaman mahawara ta shigarwa.
var saveOptionsSerialized = "{ \"TextDelimiter\":\"Comma\", \"IncludeHeaders\":false,\"NonExistingTestProperty\":false," +
"\"View\":{ \"Columns\":[{Type:\"GanttChartColumn\",\"Name\":\"TestColumn1\",\"Property\":\"Name\",\"Width\":120}," +
"{Type:\"GanttChartColumn\",\"Name\":\"TestColumn2\",\"Property\":\"Duration\",\"Width\":120}]}}";
Ƙirƙiri misalin SaveOptions inda muke ayyana kaddarorin al’ada don aikin juyawa.
tasksApi.PostTaskDocumentWithFormat(new PostTaskDocumentWithFormatRequest(){.....}
Kira API don fara aikin juyawa. A cikin wannan hanyar, muna ƙaddamar da sunan shigar da fayil MPP, da misalin SaveOptions azaman muhawara.
saveToDisk(finalResponse, resultant);
Kira hanyar al’ada don adana sakamakon aikin littafin (an dawo azaman misali rafi) zuwa ma’ajiyar gida.
// Don ƙarin misalai, da fatan za a ziyarci https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-dotnet
// Samu bayanan abokin ciniki daga https://dashboard.aspose.cloud/
string clientSecret = "4d84d5f6584160cbd91dba1fe145db14";
string clientID = "bb959721-5780-4be6-be35-ff5c3a6aa4a2";
// ƙirƙirar misalin TasksApi
TasksApi tasksApi = new TasksApi(clientSecret, clientID);
// Sunan shigar da fayil MPP
String inputFile = "Home move plan.mpp";
// sunan resultant HTML fayil
String resultant = "resultant.xlsx";
// Saitunan SaveOptions wakilcin jeri-jeri ne na json
// Ajin SaveOptions na Aspose.Tasks ko takamaiman magadansa (kamar CsvOptions, da sauransu):
var saveOptionsSerialized = "{ \"TextDelimiter\":\"Comma\", \"IncludeHeaders\":false,\"NonExistingTestProperty\":false," +
"\"View\":{ \"Columns\":[{Type:\"GanttChartColumn\",\"Name\":\"TestColumn1\",\"Property\":\"Name\",\"Width\":120}," +
"{Type:\"GanttChartColumn\",\"Name\":\"TestColumn2\",\"Property\":\"Duration\",\"Width\":120}]}}";
// Yaba Aiki daga misalin kirtani mai ɗauke da JSON
var saveOptions = JObject.Parse(saveOptionsSerialized);
// kira API don canza MPP zuwa tsarin XLSX ta amfani da misalin SaveOptions
var finalResponse = tasksApi.PostTaskDocumentWithFormat(new PostTaskDocumentWithFormatRequest()
{
SaveOptions = saveOptions,
Format = ProjectFileFormat.Xlsx,
Name = inputFile,
ReturnAsZipArchive = false
});
// Ajiye sakamakon aikin Excel zuwa faifan gida
saveToDisk(finalResponse, resultant);
// Hanya don adana abun ciki na rafi zuwa fayil akan faifan gida
public static void saveToDisk(Stream responseStream, String resultantFile)
{
var fileStream = File.Create(resultantFile);
responseStream.Seek(0, SeekOrigin.Begin);
responseStream.CopyTo(fileStream);
fileStream.Close();
}
Za a iya sauke samfurin fayil ɗin MPP da aka yi amfani da shi a cikin misalin da ke sama daga Tsarin motsa gida.mpp.
Maida MPP zuwa Excel tare da Umarnin CURL
Tare da Aspose.Tasks Cloud da umarnin cURL a hannun ku, canza MPP zuwa Excel yana kan yatsanku. Wannan haɗin gwiwa mai ƙarfi yana ba da ingantacciyar hanya don sauya fayilolin Microsoft Project (MPP) zuwa littattafan aikin Excel (XLS ko XLSX) ba tare da wani ilimin shirye-shirye ba. Don haka, ko kuna sarrafa fitar da bayanai ta atomatik, haɓaka iyawar rahoto, ko daidaita ayyukan aikin ku, wannan hanyar tana tabbatar da cewa canjin MPP ɗinku zuwa Excel duka sassauƙa ne kuma mai isa.
Mataki na farko a wannan hanyar shine samar da alamar samun damar JWT ta amfani da umarni mai zuwa:
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=163c02a1-fcaa-4f79-be54-33012487e783&client_secret=c71cfe618cc6c0944f8f96bdef9813ac" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
Da zarar muna da alamar JWT, da fatan za a aiwatar da umarni mai zuwa don fitarwa fayil ɗin MS Project (MPP) zuwa takaddar aikin Excel.
curl -v -X GET "https://api.aspose.cloud/v3.0/tasks/{inputFile}/format?format=xlsx&returnAsZipArchive=false" \
-H "accept: multipart/form-data" \
-H "authorization: Bearer <JWT Token>" \
-o resultant.xlsx
Sauya ‘inputFile’ tare da sunan shigar da daftarin aiki MPP da ake samu a cikin ma’ajiyar girgije kuma, maye gurbin ‘accessToken’ tare da alamar samun damar JWT da aka samar a sama.
Kammalawa
A cikin wannan labarin, mun ƙware ingantacciyar hanya don sauya fayilolin Microsoft Project (MPP) zuwa Excel (XLS ko XLSX) don mu iya canza bayanan aikin mu don ingantaccen rahoto, bincike, da rabawa. Ko kun zaɓi Aspose.Tasks Cloud SDK don .NET ko zaɓi don sassauci na Aspose.Tasks Cloud da umarnin cURL, bayanan aikin ku zai zama mafi sauƙi kuma mai dacewa, yana ba da hanya don ƙarin yanke shawara da ingantaccen sakamakon aikin. .
Duk hanyoyin biyu suna ƙarfafa manajojin ayyukan, manazarta, da ƙungiyoyi don daidaita tsarin sarrafa bayanan su, tabbatar da cewa bayanan aikin suna canzawa cikin sauƙi tsakanin tsari.
Hanyoyin haɗi masu amfani
Labarai masu alaka
Muna ba da shawarar ziyartar shafukan yanar gizo masu zuwa: