mpp da html

Maida fayil ɗin MS Project (MPP) zuwa HTML tare da NET REST API.

A cikin yanayin saurin tafiyar da ayyukan yau, aiki tare da haɗin gwiwa suna da mahimmanci. Fayilolin Microsoft Project (MPP) suna aiki azaman ƙashin bayan tsara ayyuka, ɗauke da mahimman bayanai waɗanda ke jagorantar ƙungiyoyi zuwa ga nasara. Koyaya, idan ya zo ga rabawa, samun dama, da haɗin gwiwa na lokaci-lokaci, fayilolin MPP na iya raguwa a wasu lokuta. Wannan shine inda buƙatar MPP zuwa HTML ya bayyana. A cikin wannan labarin, za mu bincika dalilai masu tursasawa bayan wannan canji kuma mu jagorance ku ta hanyar canza fayilolin MPP zuwa HTML ta amfani da NET REST API. Wannan jujjuyawar yana bawa ƙungiyoyi damar yin hulɗa tare da bayanan aikin a cikin ƙarin ƙarfi, daɗaɗawa, da kuma jan hankali na gani.

Cloud SDK don Canjawar HTML zuwa MPP

Aspose.Tasks Cloud SDK for .NET kayan aiki ne mai ƙarfi da dacewa wanda aka tsara don haɓaka ƙoƙarin gudanar da ayyukan ku. Tare da cikakkun fasalin fasalin sa, yana ba ku damar sarrafa, gani, da haɗin kai akan fayilolin Microsoft Project (MPP) ɗinku ba tare da matsala ba. Daga fitar da bayanan aikin zuwa ƙirƙirar rahotanni masu fa’ida, ɗaya daga cikin fitattun abubuwansa shine ikon canza fayilolin MPP zuwa HTML. Don haka, buɗe yuwuwar bayanan aikin ku kuma canza shi zuwa abubuwan gani, shafukan HTML masu iya rabawa, duk yayin da ake amfani da ƙarfin wannan babban SDK.

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. Na biyu, sami takaddun shaidar abokin ciniki daga dashboard ɗin girgije.

Idan ba ku da asusu, kawai ƙirƙiri asusun kyauta ta bin umarnin da aka kayyade akan saurin farawa.

Maida MPP zuwa HTML tare da C# .NET

Da fatan za a bi matakan da aka bayar a ƙasa don yin fassarar MPP zuwa HTML ta amfani da C# .NET.

// 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.html";

// ƙirƙiri buƙatun sauya fayil MPP
var request = new GetTaskDocumentWithFormatRequest();

// saka sunan shigar MPP daga ma'ajiyar gajimare
request.Name = inputFile;

// saita HTML azaman tsarin sakamako
request.Format = ProjectFileFormat.Html;

// Idan wannan sigar gaskiya ce, ana haɗa albarkatun HTML azaman fayiloli daban da
// dawo tare da sakamakon HTML fayil azaman fakitin zip.
request.ReturnAsZipArchive = false;

// Yi canjin MPP zuwa HTML kuma dawo da fitarwa a cikin misali rafi
Stream response = tasksApi.GetTaskDocumentWithFormat(request);

if (response != null)
{
    Console.WriteLine("MS Project file (MPP) successfully converted to HTML !");
}

// Hanyar al'ada don adana sakamakon fayil a kan tsarin gida
saveToDisk(response, 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();
}
mpp da html

Canza MPP zuwa HTML samfoti.

Ana ba da cikakkun bayanai masu sauri game da snippet na sama da aka bayyana.

TasksApi tasksApi = new TasksApi(clientSecret, clientID);

Ƙirƙiri wani abu na ajin TasksApi yayin wucewa da bayanan abokin ciniki azaman mahawara ta shigarwa.

var request = new GetTaskDocumentWithFormatRequest();

Ƙirƙiri abin nema don samar da fayil ɗin MPP a tsarin da ake so.

request.Format = ProjectFileFormat.Html;

Ƙayyade tsarin fitarwa na fayil azaman HTML.

Stream response = tasksApi.GetTaskDocumentWithFormat(request);

Kira API don fara aikin canza MPP zuwa HTML. Hanyar tana tsammanin shigar da MPP ya kasance a cikin ma’ajin gajimare.

Za a iya sauke samfurin fayil ɗin MPP da aka yi amfani da shi a cikin fayil ɗin misali na sama daga Tsarin motsi na gida.mpp.

Fitar da MPP zuwa HTML ta amfani da Umarnin CURL

Mun koyi cewa Aspose.Tasks Cloud mafita ce mai ma’ana don sarrafa fayilolin Microsoft Project (MPP) kuma yana ba da cikakkiyar damar aiki. Bugu da ƙari, sassauci da ikon SDK don haɗawa tare da umarnin cURL yana sa MPP zuwa fassarar HTML ya fi dacewa. Bari mu ƙara bincika wannan fasalin don sauƙaƙa sauya fayilolin MPP zuwa tsarin HTML na yanar gizo.

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 wannan umarni don fitarwa fayil ɗin MS Project (MPP) zuwa tsarin HTML.

curl -X GET "https://api.aspose.cloud/v3.0/tasks/{sourceFile}/format?format=html&returnAsZipArchive=false" \
-H "accept: multipart/form-data" \
-H "authorization: Bearer <JWT Token>" \
-o resultant.html

Sauya ‘sourceFile’ tare da sunan shigarwar daftarin aiki MPP samuwa a cikin Cloud ajiya kuma, maye gurbin ‘accessToken’ tare da alamar samun damar JWT da aka samar a sama.

Kammalawa

A ƙarshe, mun bincika hanyoyi guda biyu masu amfani don canza fayilolin MPP zuwa HTML, kowannensu yana da fa’idodinsa na musamman. Aspose.Tasks Cloud don NET yana ba da cikakkiyar SDK mai dacewa da mai amfani wanda ke sauƙaƙe tsarin juyawa. A gefe guda, mun kuma ga inganci da samun damar da cURL ke ba da umarni waɗanda ke yin jujjuya kai tsaye da inganci, manufa ga waɗanda suka fi son mafita-layi.

Ko kun zaɓi tsarin sada zumunta na SDK ko kuma ingantaccen tsarin umarni na cURL, kun cika burin ku na canza bayanan aikin ku zuwa tsarin sada zumunta na yanar gizo, haɓaka samun dama da haɗin gwiwa.

Hanyoyin haɗi masu amfani

Labarai masu alaka

Muna ba da shawarar ziyartar shafukan yanar gizo masu zuwa: