A fagen sarrafa daftarin aiki, buƙatar raba Takardun Kalma yana fitowa a matsayin mafita mai mahimmanci, yana magance ƙalubalen da ke tattare da dogayen fayiloli da kuma buƙatun cire abun ciki da aka yi niyya. . Ko kuna ma’amala da rahotanni masu yawa, ayyukan haɗin gwiwa, ko takardu masu yawa, ikon raba takaddun Word yadda ya kamata ya zama mahimmanci. Wannan labarin yana haɓaka haɗin gwiwa, samun dama, da ingantaccen aikin aiki gabaɗaya ta amfani da NET REST API.
- Cloud SDK zuwa Rarraba Takardun Kalma
- Raba fayilolin DOC a cikin C# .NET
- Raba Shafukan Doc Word ta amfani da Umarnin CURL
Cloud SDK zuwa Rarraba Takardun Kalma
Yin amfani da Aspose.Words Cloud SDK don NET don cika aikin rarraba takardun Kalma yana ba da mafita mai ƙarfi da haɓakawa. Wannan SDK yana ba da cikakkiyar tsarin kayan aiki da hanyoyin, yana ba da damar haɗa kai cikin aikace-aikacen NET.
Da farko, muna buƙatar bincika ‘Aspose.Words-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 asusun da ke akwai, kawai ƙirƙirar asusun kyauta ta bin umarnin da aka kayyade a cikin labarin saurin farawa.
Raba fayilolin DOC a cikin C# .NET
Da fatan za a bi umarnin da aka bayar a ƙasa don raba shafuka a cikin takaddar Kalma zuwa fayiloli guda ɗaya ta amfani da C# .NET.
WordsApi wordsApi = new WordsApi(new Configuration()
{
ClientId = clientID,
ClientSecret = clientSecret
});
Ƙirƙiri wani abu na ajin WordsApi inda muka wuce abin Kanfigareshan azaman hujja.
var request = new SplitDocumentRequest(inputFileName, format: outputFormat, zipOutput: isZipArchive);
Ƙirƙiri misali na Buƙatun Buƙatun SplitDocument inda muka ƙaddamar da sunan shigar da takaddun Kalma, tsarin fitarwa azaman ‘DOC’ da siga da ke nuna cewa fitarwar sakamakon ba za a adana zip ɗin ba.
var output = wordsApi.SplitDocument(request);
A ƙarshe, kira API don raba daftarin aiki zuwa fayilolin mutum ɗaya kuma adana fitarwa a cikin ajiyar girgije.
- Idan kuna son raba wasu kewayon shafuka a cikin takaddar Word, kuna iya ƙididdige ƙimar akan mahawara ‘Daga’ da ‘To’. Idan babu komai, ana yin aikin tsaga a duk shafuka.
// Don cikakkun misalai da fayilolin bayanai, da fatan za a je zuwa
https://github.com/aspose-words-cloud/aspose-words-cloud-dotnet
// Samu bayanan abokin ciniki daga https://dashboard.aspose.cloud/
string clientSecret = "4d84d5f6584160cbd91dba1fe145db14";
string clientID = "bb959721-5780-4be6-be35-ff5c3a6aa4a2";
// Ƙirƙiri misali na ajin WordsApi
WordsApi wordsApi = new WordsApi(new Configuration()
{
ClientId = clientID,
ClientSecret = clientSecret
});
/ Name of input word document
String inputFileName = "test_result.docx";
// format na resultant fayil
string outputFormat = "DOC";
// Sunan daftarin aiki bayan aiki. Idan an bar wannan siga
// sannan za'a adana fayil ɗin sakamako tare da sunan takaddar shigarwa
String resultantFile = "Split-File";
// Tutar tana nuna ko za a fitar da ZIP.
bool isZipArvhive = false;
// Ƙirƙiri abu don Rarraba Takardu
var request = new SplitDocumentRequest(inputFileName, format: outputFormat, zipOutput: isZipArvhive);
// fara aikin Raba Kalma
var output = wordsApi.SplitDocument(request);
Raba Shafukan Doc Word ta amfani da Umarnin CURL
Cimma aikin rarraba takaddun Kalma ta amfani da umarnin cURL tare da Aspose.Words Cloud API yana ba da madaidaiciyar hanya, tsarin umarni-kore. Bugu da ƙari, ga masu amfani da jin daɗin kayan aikin layin umarni, wannan hanyar tana ba da hanya mai sauri da sauƙi don cimma rarrabuwar daftarin aiki.
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 an ƙirƙiri alamar JWT, da fatan za a aiwatar da umarni mai zuwa don raba daftarin aiki zuwa fayilolin DOC guda ɗaya. API ɗin kuma yana ba da damar yin amfani don tantance tsarin fayil ɗin sakamako (tsara masu yuwuwar na iya zama DOC, DOCX, PDF, da sauransu).
curl -v "https://api.aspose.cloud/v4.0/words/{sourceFile}/split?format=DOC" \
-X PUT \
-H "Authorization: Bearer {accessToken}" \
-d ""
Sauya ‘sourceFile’ tare da sunan shigar da daftarin aiki da akwai riga a cikin ma’ajin gajimare, da ‘accessToken’ tare da alamar samun damar JWT da aka samar a sama.
Kammalawa
A ƙarshe, aikin rarrabuwar takaddun Word yana buɗe hanyoyi guda biyu daban-daban amma masu tasiri, kowanne yana biyan bukatun masu amfani daban-daban. Lokacin amfani da NET Cloud SDK, masu haɓakawa suna samun kayan aiki mai ƙarfi kuma mai fa’ida, ba tare da ɓata lokaci ba suna haɗa daftarin aiki masu rarraba ayyuka cikin aikace-aikacen NET ɗin su. A gefe guda, yin amfani da umarnin cURL tare da Aspose.Words Cloud API yana ba da madadin umarni mai sauri da sauƙi, wanda ya dace da masu amfani tare da bambancin fasahar fasaha.
Hanyoyin haɗi masu amfani
Labarai masu alaka
Muna ba da shawarar ziyartar shafukan yanar gizo masu zuwa: