Excel ana amfani da takaddun aiki akai-akai don sarrafawa da nazarin bayanai a masana’antu daban-daban. Koyaya, akwai lokutan da wasu bayanai ko ƙididdiga ke buƙatar kariya daga gyare-gyare na haɗari ko ganganci. Anan ne kariyar kalmar sirri ta shiga wasa. Kariyar kalmar sirri tana ba masu amfani damar ƙuntata damar shiga ko gyara damar aikin Excel ɗin su. Duk da yake wannan fasalin yana ba da tsaro ga bayanan ku, kuma yana iya haifar da takaici lokacin da kuke buƙatar yin canje-canje ga takaddun aiki mai kariya. A cikin wannan labarin, za mu nuna muku yadda ake rashin kariya ga takaddun aikin Excel ta amfani da C# .NET, yana ba ku cikakken iko akan bayanan ku kuma.
- API zuwa Ƙarfafa Excel
- Ba da kariya ga takardar Excel ta amfani da C#
- Buɗe takardar Excel ta amfani da Umarnin CURL
API zuwa Ƙarfafa Excel
Aspose.Cells Cloud API ne mai ƙarfi da haɓakawa wanda ke ba ku damar aiki tare da fayilolin Excel. Hakanan yana ba da fa’idodi da yawa, gami da ikon rashin kariyar takaddun aikin Excel. Tare da daidaitawar giciye-dandamali, haɗin kai maras kyau, tsaro mai ƙarfi, da ƙimar farashi, babban zaɓi ne ga masu haɓakawa waɗanda ke neman aiki tare da fayilolin Excel a cikin girgije. Baya ga fasalin da ba shi da kariya, Aspose.Cells Cloud yana ba da fa’idodi da yawa, gami da:
- Daidaituwar dandamali
- Haɗin kai mara kyau: Haɗa tare da Dropbox, Google Drive, da Amazon S3, yana ba ku damar sarrafa fayilolin Excel cikin sauƙi.
- Tsaro mai ƙarfi: Tabbacin OAuth2 da ɓoyewar SSL yana tabbatar da amincin bayanai.
- Mai tsada: Zaɓuɓɓukan farashi masu sassauƙa, inda kawai kuke biyan sabis ɗin da kuke amfani da su.
Yanzu don amfani da Aspose.Cells Cloud SDK don NET (wanda shine abin rufewa a kusa da Aspose.Cells Cloud), bincika Aspose.Cells-Cloud a cikin manajan fakitin NuGet kuma danna maɓallin “Ƙara Kunshin”. Hakanan kuna buƙatar ƙirƙirar asusu akan Dashboard ta amfani da ingantaccen adireshin imel.
Ba da kariya ga takardar Excel ta amfani da C#
Domin cire kalmar sirri daga takardun aiki na Excel, da fatan za a gwada amfani da snippet na gaba.
// Don cikakkun misalai da fayilolin bayanai, da fatan za a je zuwa
https://github.com/aspose-cells-cloud/aspose-cells-cloud-dotnet/
// Samu bayanan abokin ciniki daga https://dashboard.aspose.cloud/
string clientSecret = "4d84d5f6584160cbd91dba1fe145db14";
string clientID = "bb959721-5780-4be6-be35-ff5c3a6aa4a2";
// ƙirƙiri misalin CellsApi yayin wuce ClientID da ClientSecret
CellsApi cellsInstance = new CellsApi(clientID, clientSecret);
// farkon littafin aikin Excel akan tuƙi
string input_Excel = "protected.xlsx";
try
{
// Ƙirƙiri misali mai riƙe bayanan ɓarna
WorkbookEncryptionRequest protection = new WorkbookEncryptionRequest();
protection.Password = "123456";
protection.KeyLength = 128;
protection.EncryptionType = "XOR";
// karanta fayil ɗin Excel kuma loda zuwa ajiyar girgije
cellsInstance.UploadFile(input_Excel, File.OpenRead(input_Excel));
// fara aikin buše littafin aiki
var response = cellsInstance.CellsWorkbookDeleteDecryptDocument(input_Excel, protection, null);
// buga saƙon nasara idan haɗin kai ya yi nasara
if (response != null && response.Equals("OK"))
{
Console.WriteLine("Workbook unlock operation successful !");
Console.ReadKey();
}
}
catch (Exception ex)
{
Console.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
Ƙayyadaddun da ke ƙasa sune cikakkun bayanai game da snippet na sama:
CellsApi cellsInstance = new CellsApi(clientID, clientSecret);
Ƙirƙiri wani abu na CellsApi yayin ƙaddamar da bayanan abokin ciniki azaman muhawara.
WorkbookEncryptionRequest protection = new WorkbookEncryptionRequest();
protection.Password = "123456";
protection.KeyLength = 128;
protection.EncryptionType = "XOR";
Ƙirƙiri misali WorkbookEncryptionRequest riqe da littafin aiki yana yanke bayanin
cellsInstance.UploadFile(input_Excel, File.OpenRead(input_Excel));
Loda ɓoyayyen Excel zuwa ma’ajin gajimare.
var response = cellsInstance.CellsWorkbookDeleteDecryptDocument(input_Excel, protection, folder);
Kira API don rashin kariyar Excel kuma adana fitarwa zuwa ma’ajin gajimare.
Za a iya saukar da ɓoyayyen Excel ɗin da aka yi amfani da shi a cikin misalin da ke sama daga [protected.xlsx](hotuna/mai kariya.xlsx).
Buɗe takardar Excel ta amfani da Umarnin CURL
Samun dama ga Aspose.Cells Cloud ta hanyar umarnin cURL yana ba da hanya mai sauƙi da sauƙi don aiki tare da API. Tare da cURL, zaku iya amfani da Aspose.Cells Cloud tare da kowane yaren shirye-shirye ko dandamali wanda ke goyan bayan cURL, yana ba da sassauci a yanayin ci gaban su. Bugu da ƙari, cURL kayan aiki ne mai sauƙi wanda baya buƙatar kowane haɗaɗɗiyar saiti ko shigarwa, yana sauƙaƙa wa masu haɓakawa don haɗawa da sauri tare da API. Saboda haka, ta amfani da umarnin cURL don yin hulɗa tare da Aspose.Cells Cloud, za ku iya daidaita ayyukan ku da inganta yawan aiki.
Yanzu, kuna buƙatar shigar da cURL akan tsarin ku sannan ku samar da damar shigaToken dangane da bayanan abokin ciniki:
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"
Yi amfani da umarni mai zuwa don loda shigarwar Excel zuwa ma’ajiyar gajimare:
curl -v "https://api.aspose.cloud/v3.0/cells/storage/file/{filePath}" \
-X PUT \
-F file=@{localFilePath} \
-H "Content-Type: multipart/form-data" \
-H "Authorization: Bearer {accessToken}"
Sauya
{filePath}
tare da hanyar da kake son adana fayil ɗin a cikin ma’ajiyar gajimare, `{localFilePath}’ tare da hanyar Excel akan tsarin gida, da ‘‘accessToken}’ tare da alamar samun damar Aspose Cloud. (wanda aka samar a sama).
A ƙarshe, aiwatar da umarni mai zuwa don hana takaddar Excel akan layi:
curl -v "https://api.aspose.cloud/v3.0/cells/{excelFile}/encryption" \
-X DELETE \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}" \
-H "Content-Type: application/json" \
-d "{ \"EncryptionType\": \"XOR\", \"KeyLength\": 128, \"Password\": \"123456\"}"
Sauya
{excelFile}
da sunan rufaffen fayil ɗin Excel daga ma’ajiyar gajimare, `{accessToken}’ tare da alamar shiga da aka samar a sama. Bayan aiki mai nasara, za a adana Excel mara kariya a cikin ma’ajiyar girgije iri ɗaya.
Karshen Magana
A cikin wannan labarin, mun tattauna yadda za a ba da kariya ga takardun aikin Excel ta amfani da Aspose.Cells Cloud, API wanda ke ba da hanya mai sauƙi don yin aiki tare da fayilolin Excel a cikin girgije. Mun kuma bayyana fa’idodin yin amfani da Aspose.Cells Cloud, gami da daidaitawar dandamali, haɗin kai mara kyau, ingantaccen tsaro, da ƙimar farashi. Bugu da ƙari, mun tattauna fa’idodin samun damar Aspose.Cells Cloud ta hanyar umarnin cURL, kamar sassauƙa, sauƙi, da ingantattun kayan aiki. Ta bin matakan da aka zayyana a cikin wannan labarin, zaku iya sauƙaƙe takaddun aikin Excel ba tare da kariya ba kuma ku sarrafa tsarin sarrafa fayilolinsu na Excel. Gabaɗaya, Aspose.Cells Cloud da cURL suna ba da haɗin gwiwa mai ƙarfi na kayan aiki don masu haɓaka waɗanda ke neman aiki tare da fayilolin Excel a cikin girgije.
Hanyoyin haɗi masu amfani
Abubuwan da aka Shawarar
Da fatan za a ziyarci hanyoyin haɗin yanar gizon don ƙarin koyo game da: