Password Protecting an Excel file in C

0 votes
Anyone who is familiar with this syntax? I've looked all everywhere, but the only thing I can find is C++ code for this. Using the System.IO.Packaging namespace, I'm attempting to programmatically password-protect an excel file.

Any thoughts?
Oct 30 in Others by Kithuzzz
• 20,660 points
44 views

1 answer to this question.

0 votes

Try this:

using Microsoft.Office.Interop.Excel

//create your spreadsheet here...

WorkbookObject.Password = password;
WorkbookObject.SaveAs("spreadsheet.xls")

I hope this helps you.

answered Oct 30 by narikkadan
• 37,660 points

Related Questions In Others

0 votes
1 answer

Removing specific rows in an Excel file using Azure Data Factory

Under the 'Source' tab, choose the number ...READ MORE

answered Sep 23 in Others by narikkadan
• 37,660 points
187 views
0 votes
1 answer

Create Graph from data in an excel file

Your first step would be to become ...READ MORE

answered Oct 17 in Others by narikkadan
• 37,660 points
37 views
0 votes
1 answer
0 votes
0 answers

Format an Excel column (or cell) as Text in C#?

When I copy values from a data ...READ MORE

Oct 31 in Others by Kithuzzz
• 20,660 points
43 views
0 votes
1 answer

Generate a flat list of all excel cell formulas

Hello, you'll have to follow certain steps ...READ MORE

answered Feb 18 in Others by gaurav
• 22,040 points
73 views
0 votes
1 answer

Convert a number to a letter in C# for use in Microsoft Excel [duplicate]

If you are familiar with using formulas ...READ MORE

answered Feb 23 in Database by gaurav
• 22,040 points
138 views
0 votes
1 answer

Deleting duplicate rows in Excel using Epplus

You need to re-think this… the while ...READ MORE

answered Feb 23 in Database by gaurav
• 22,040 points
275 views
0 votes
1 answer

Export DataTable to Excel File

Add Interop References. First we need to ...READ MORE

answered Jun 9 in JQuery by gaurav
• 22,040 points
93 views
0 votes
1 answer

How to open an Excel file in C#?

You must have Microsoft Visual Studio Tools ...READ MORE

answered Nov 13 in Others by narikkadan
• 37,660 points
31 views
0 votes
1 answer

Referencing an Excel file, workbook, worksheet in C#

Try the following code. using System; using System.Data; using Excel ...READ MORE

answered Nov 19 in Others by narikkadan
• 37,660 points
14 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP