can we create password protected excel workbook or sheet with 'Officewriter' API? My requirement is to create pwd protected excel programatically (c#) with out having to install office in the servers.
I have tried with openXML but the when password protected the file is showing as corrupted and not opening.
Anybody let me know if this is possible with 'Officewriter'.
Note: I work for SoftArtisans, makers of OfficeWriter.
Yes, it is possible to password protect an Excel workbook programmatically with OfficeWriter.
If you are using our ExcelApplication API to programmatically manipulate a workbook, you can protect workbooks and worksheets.
Workbook.Protect(string) will protect the structure of the workbook with the supplied password. For example, users won't be able to add or remove worksheets without the password.
Worksheet.Protect(string) write-protects the worksheet so users cannot modify the worksheet in Excel without entering the password.
ExcelApplication xla = new ExcelApplication();
Workbook wb = xla.Open("myWorkbook.xlsx");
wb.Protect("workbookPassword");
wb.Worksheets["Sheet1"].Protect("worksheetPassword");
xla.Save(wb, "myWorkbook_output.xlsx");
If you are using our ExcelTemplate API to bind data to a template that contains placeholder markers, you can set ExcelTemplate.EncryptPassword which will encrypt the workbook with the given password using RC4 encryption.
ExcelTemplate xlt = new ExcelTemplate();
xlt.Open("template.xlsx");
...
xlt.EncryptPassword = "MyPassword";
xlt.Process();
xlt.Save("output.xlsx");
Related
I am opening an existing Excel file using SpreadsheetGear, using the following code:
SpreadsheetGear.IWorkbook xlBook = SpreadsheetGear.Factory.GetWorkbook(fileName, System.Globalization.CultureInfo.CurrentCulture);
xlBook.SaveAs(fileNameCSV, SpreadsheetGear.FileFormat.CSV);
This works, but the saved CSV file contains the wrong sheet.
Can anyone help with a code snippet on how to open an Excel file in SpreadsheetGear, then save only a SPECIFIC sheet to a CSV file.
Please note I am working with SpreadsheetGear and want a solution for that library. Thanks!
The IWorksheet interface includes a SaveAs(...) method for just this purpose:
using SpreadsheetGear;
using System.Globalization;
...
IWorkbook xlBook = Factory.GetWorkbook(fileName, CultureInfo.CurrentCulture);
xlBook.Worksheets["My Sheet"].SaveAs(fileNameCSV, FileFormat.CSV);
I'll also mention that there is also an IRange.SaveAs(...) method if you want to save just a particular range to CSV / UnicodeText (tab-delimited).
I have an excel sheet having all the details like user id, emailid ,password ,firstname and lastname. How can import this excel so that it imports are all the users under path /home/users/test.
Either use Apache POI to write some custom code that reads in the rows of the sheet, and then uses the [JackRabbit UserManager][2] library to create the users.
Alternatively, simply save the Excel as a CSV and write a (bash or bat) script that iterates over the CSV file and calls a POST command to create the user:
curl -u admin:admin -FcreateUser= -FauthorizableId=$UserNameReadFromCSV -Frep:password=$PasswordReadFromCSV http://localhost:4502/libs/granite/security/post/authorizables
May be I am late to the party but I have been working on this requirement and created a utility in the AEM for the same.
This utility allows the users to upload an excel file with the user details and creates users in the AEM to the desired group automatically.
https://aem.redquark.org/2019/05/create-users-in-aem-from-excel-file.html
You can see the code for the same at my GitHub. https://github.com/ani03sha/BulkUserCreation
I hope this helps someone.
Is it possible to create PDF documents (e.g. on a nightly schedule) with Tableau and have those documents exposed by a URL by the Tableau server?
This sort of approach is common in the Jasper Reports and BIRT world, so I was wondering if the same approach is possible with Tableau?
I couldn't see any documentation on the Tableau site for creating PDFs, other than print to PDF
With Tableau Server, you can access your published workbook in a pdf format with this URL:
http://nameofyourtableauserver/views/NameOfYourWorkbook/NameOfYourView.pdf
Simply, the url is the url of your view + you add ".pdf".
The pdf file will be generated dynamically when accessing the URL.
Another option is to program your own script with tabcmd.
You can have more info on tabcmd here: http://kb.tableausoftware.com/articles/knowledgebase/using-tabcmd
The same technique also works for PNG. You can control filters using ?field_name=value. You can even select multiple values like this ?field_name=value1,value2.
Parameters can be set the same way.
Personally I've had the best luck with discrete dimensions instead of continuous ones.
I use the Windows Task Scheduler with batch files and Tabcmd.
Programs needed:
Tabcmd
Windows TaskScheduler (All Programs- Accessories - system tools)
http://onlinehelp.tableausoftware.com/v8.1/server/en-us/tabcmd_overview.htm
(tabcmd, how it works?)
Batchfile (create a text file and then save with file extension .bat):
1- Locate tabcmd and login
2- use function tabcmd get "http:\..." and -f "C:...pdf" to save to file.
3- concatenate the filters you want to use to the end of your URL as shown in other answers(all filters on the view must be included(filled out))
4- Save Batch file
Windows Task Scheduler:
1- create a task that will execute the batch file
2- TEST
You can do this by typing
http://server/views/WorkbookName/SheetName.pdf?:format=pdf
Another option will be using javascript api like below..
function exportPDF() {
viz.showExportPDFDialog();
}
I am trying to read a password protected excel file, the problem I am having with the following code is it does not take care of password, but instead excel application opens but user has to go to taskbar and click excel app to see the password query.
path = fullfile(pwd,'tests.xls')
e=actxserver('excel.application');
eW = e.Workbooks;
eF = eW.Open(file3,'GSL');
[num,txt,raw] = xlsread(file3, 1);
I can think of two ways to solve the problem. I don't have access to a Windows machine so you'll have to figure out the details yourself:
Use Matlab's GUI functions to ask the user for the password. Then, supply that password to the Open method along with the filename (Excel Open method documentation).
After calling actxserver try to bring the Excel window into focus so that when you open the file, the password dialog box is visible. Something like described here should work.
Hello I have a crystalReportViewer and CrystalReportSource on a web form.
I need to be able to bind the reportSource at run time to different report files.
I have the file data stored in a blob in a DB.
The mechanism I am using now is to save the blob to a file and then
this.CrystalReportSource1.Report.FileName = myFileName;
The issue is that I want to avoid saving the file on disk and somehow bind the report directly to a file stream.
Is that possible?
Thanks
In C#, I believe that you should be able to use something like the following, but I haven't tested it out on my system.
ReportDocument rpt = new ReportDocument();
rpt.Load(filestream); //filestream is your filestream object
Give it a try and let me know if you have issues.