A cikin zamanin dijital na yau, tsaron daftarin aiki ya zama babban fifiko ga mutane da kungiyoyi iri ɗaya. Tare da karuwar dogaro akan takaddun lantarki, yana da mahimmanci don tabbatar da cewa fayilolin da muke rabawa na gaskiya ne kuma ba a yi musu tambari ba. Excel shine irin wannan kayan aiki wanda ake amfani dashi don adanawa da raba mahimman bayanai, yana mai da mahimmanci a sami ingantaccen hanyar tabbatar da amincin fayil ɗin. Wannan shine inda sa hannun dijital ke shigowa - suna samar da amintacciyar hanya don sa hannu da tabbatar da takaddun lantarki, tabbatar da cewa fayil ɗin bai canza ba tun lokacin da aka sanya hannu. A cikin wannan labarin, za mu bincika yadda ake sa hannu kan fayilolin Excel ta hanyar lambobi ta amfani da C# .NET.
- API zuwa Digitally Sign Excel
- Ƙara Sa hannun Lantarki ta amfani da C#
- Ƙara Sa hannu na Dijital na Excel ta amfani da Umarnin CURL
API zuwa Digitally Sign Excel
Aspose.Cells Cloud SDK don NET API ne mai ƙarfi wanda ke ba da kewayon fasali don aiki tare da Excel fayiloli a cikin gajimare. Ɗaya daga cikin mahimmin ƙarfinsa shine ikon sa hannu kan fayilolin Excel ta lambobi, samar da amintacciyar hanya don tantancewa da tabbatar da takaddun lantarki. Tare da Aspose.Cells Cloud SDK, masu amfani za su iya shiga cikin sauƙi fayilolin Excel ta amfani da kewayon nau’ikan sa hannu gami da takaddun shaida na dijital). Bari mu bincika iyawar API kuma mu tabbatar da mutunci da amincin takaddun lantarki.
Don farawa, bincika Aspose.Cells-Cloud a cikin manajan fakitin NuGet kuma danna maɓallin “Ƙara Kunshin”. Hakanan, idan baku da asusu akan Dashboard, da fatan za a ƙirƙiri asusun kyauta ta amfani da ingantaccen adireshin imel.
Ƙara Sa hannun Lantarki ta amfani da C#
Da fatan za a yi amfani da snippet code mai zuwa don sanya hannu kan fayilolin Excel a lambobi.
// 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 = "source.xlsx";
// sunan takardar shaidar dijital
string signature_File = "test1234.pfx";
try
{
// karanta fayil ɗin Excel kuma loda zuwa ajiyar girgije
cellsInstance.UploadFile(input_Excel, File.OpenRead(input_Excel));
// karanta takardar shaidar Dijital kuma loda zuwa ma'ajiyar gajimare
cellsInstance.UploadFile(signature_File, File.OpenRead(signature_File));
// fara aikin alamar dijital
var response = cellsInstance.CellsWorkbookPostDigitalSignature(input_Excel, signature_File, "test1234");
// buga saƙon nasara idan haɗin kai ya yi nasara
if (response != null && response.Equals("OK"))
{
Console.WriteLine("Digital Signature added successfully !");
Console.ReadKey();
}
}
catch (Exception ex)
{
Console.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
Ana ba da cikakkun bayanai game da snippet code:
CellsApi cellsInstance = new CellsApi(clientID, clientSecret);
Ƙirƙiri wani abu na CellsApi yayin ƙaddamar da bayanan abokin ciniki azaman muhawara.
cellsInstance.UploadFile(input_Excel, File.OpenRead(input_Excel));
cellsInstance.UploadFile(signature_File, File.OpenRead(signature_File));
Karanta abun ciki na shigar da Excel & sa hannun dijital daga faifan gida kuma loda su zuwa ma’ajiyar girgije.
var response = cellsInstance.CellsWorkbookPostDigitalSignature(input_Excel, signature_File, "test1234");
Kira API don sanya hannu kan lambobi a Excel kuma adana abin fitarwa zuwa ma’ajiyar girgije. Lura cewa hujja ta ƙarshe ita ce kalmar sirrin fayil ɗin takaddun shaida.
Ana iya saukar da Excel ɗin da aka yi amfani da shi a cikin misalin da ke sama daga myDocument.xlsx.
Ƙara Sa hannu na Dijital na Excel ta amfani da Umarnin CURL
Akwai fa’idodi da yawa na amfani da umarnin cURL da Aspose.Cells Cloud API don sa hannun dijital a cikin Excel. Wannan hanyar tana da inganci kuma mai sauƙin amfani, tana ba ku damar sanya hannu kan fayilolin Excel tare da buƙatun API kaɗan. Wannan yana adana lokacinku da ƙoƙarinku, idan aka kwatanta da sanya hannu kan kowace takarda da hannu. Abu na biyu, tunda wannan hanyar ta dogara ne akan gajimare, saboda haka zaku iya samun dama gare shi daga ko’ina kuma ku haɗa shi cikin ayyukan ku na yanzu cikin sauƙi. Gabaɗaya, yin amfani da umarnin cURL da Aspose.Cells Cloud API don sa hannun dijital a cikin Excel shine mafita mai ƙarfi da sassauƙa. Yana daidaita tsarin sa hannun ku kuma yana haɓaka tsaro da amincin fayilolinku na Excel.
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 & Digital sa hannu zuwa ma’ajin gajimare (kana buƙatar kiran wannan umarni sau biyu don loda fayil ɗaya):
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 ƙara sa hannun dijital zuwa fayil ɗin Excel:
curl -v "https://api.aspose.cloud/v3.0/cells/{excelName}/digitalsignature?digitalsignaturefile={DigitalSignature}&password=test1234" \
-X POST \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}"
Sauya
{excelName}
da sunan fayil ɗin Excel a cikin ma’ajiyar gajimare,{DigitalSignature}' tare da sunan takardar shedar dijital daga ma'ajiyar gajimare da,
{accessToken}’ tare da alamar shiga da aka samar a sama. Bayan nasarar aiwatarwa, za a adana sabunta Excel a cikin ma’ajiyar girgije iri ɗaya.
Karshen Magana
A ƙarshe, sa hannu na dijital a cikin Excel muhimmin al’amari ne na tabbatar da sahihanci da amincin maƙunsar bayanan ku. Don haka umarnin cURL da Aspose.Cells Cloud API yana ba da hanya mai amintacce kuma amintacce don sanya hannu kan fayilolin Excel ta hanyar shirye-shirye, adana lokaci da ƙoƙari yayin haɓaka tsaro da amincin bayanan ku. Tare da Aspose.Cells Cloud, zaku iya tsara tsarin sa hannu bisa ga takamaiman buƙatunku, ko yana ƙayyade wurin, saita kariyar kalmar sirri, ko wasu zaɓuɓɓuka. Gabaɗaya, wannan hanyar don ƙara sa hannu na dijital a cikin Excel ingantaccen tsari ne, sassauƙa, kuma amintaccen bayani wanda ke daidaita aikin ku kuma yana ba ku kwanciyar hankali da sanin cewa fayilolin Excel ɗinku amintattu ne kuma daidai.
Hanyoyin haɗi masu amfani
Abubuwan da aka Shawarar
Da fatan za a ziyarci hanyoyin haɗin yanar gizon don ƙarin koyo game da: