Trying to save a workbook that contains macros - excel-2010

I recently upgraded to Excel 2010. I was working on a spreadsheet and wrote some code and went to save it and I get this box that pops up. I'm not sure what to do.

From Office 2007 on, Excel has two different file types: XLSX and XLSM. The former is just data and formatting without macros or anything "dangerous." The latter allows macros and other programmatic functionality. The reason for the split is mainly security as each one has a distinct extension and icon to better inform the user on whether or not the file could potentially contain dangerous content.
In this instance, you need to click No, then in the Save As... options select "Excel Macro-Enabled Workbook." That will give you the full functionality of the original document.

Related

How to save multiple files at once through delphi save dialog

I'm not able to save multiple files at a time in delphi save dialog box. Multiple files means I want save files without mentioning anything(or only asterisk) at "filename" field in delphi TsaveDialog. Please let me know how to achieve that.
Of course not, because that is not what it is intended for. You CANNOT obtain multiple filenames from a single save dialog. It only provides one filename at a time. That is by design.
I suspect what you really want is to prompt the user for just a folder path instead. Use the SelectDirectory() function (or the Win32 SHBrowseForFolder() function directly) for that, then you can create whatever files you need in that folder.
The save dialog doesn't save files. It allows the user to select file names. The save dialog doesn't support multiple selection so if you want to have a file dialog that allows multiple selections you need an open dialog. But an open dialog typically is used to select names of existing files, whereas a save dialog can specify a name of a file that does not yet exist.
Wildcards when entered into file dialogs are used to filter the displayed list of files. The file dialog won't return file names containing wildcards.
You imagine using wildcards, but how would you be able to do that and create new files? Wildcards are used to pattern match against existing files.
Maybe what you need is a folder selection dialog. Or perhaps you should ask the user for the name of the "master" file and then you generate the names of the "auxiliary" files using the master file name as a stem. I'm guessing because you've not told us any specifics behind your question.
My advice is to reconsider carefully what you are attempting to achieve. Think of all possible corner cases. Explore what UI idioms are used by other programs. Make sure you understand fully the capability of the file dialog controls. And then design your UI to fit with all of these constraints.

Export data to XLS (not via CSV) on iOS

I need to export some data to an .XLS file, pdf, and print.
I already tried the simple solution: exporting it to .CSV with CHCSVWriter. It works for printing and saving it to pdf (I open the CSV in a UIWebView and get the PDF or print from there). However, to use the CSV to be open in excel has two main problems:
1 - First, as the name says, in the CSV the values are separated by commas, and in some versions of Excel, it requires the user to separate 'manually' in cells.
2 - I have hebrew characters, and I already tried all the string encodings, and can't have both hebrew and latin characters.
So, after giving up after days of trying to use CSV to solve the issues above, I gave up. How can I export my data to XLS?
The LibXL library provides this functionality for both xls and xlsx formats. There is no iOS version, but people say the iOS version is coming. You may want to contact LibXL support to confirm this.
EDIT:
The iOS version is available now.
This article explains how to programmatically create an Excel (.xls) file without using any external library. It just opens a file stream and it writes XML contents straight to it.
It is written in C#, but the core information coming out of it is the XML formatting used to create nodes and fill attributes for corresponding cell values and formatting.
Please consider I have not tried this myself, I found it while doing a search. Please feel free to ask if some C# bits are not clear. HTH

Strategy in exporting to Excel with formatting from ASP.NET?

So this is another exporting to Excel question.
I have a page that has a table with formatting by stylesheet.
When I export the page by setting the ContentType to application/excel and Content-Disposition to attachment, I can export the table to Excel (not CSV). However, it loses all formatting. I think it's because Excel does not load CSS and I guess that's reasonable.
So, in a scenario where I have to show the table on the web and also export to Excel, both with similar (even if not exact) formatting, what would be the best approach without using something like NPOI?
I am trying to minimize the work and keep the single template if possible. Is it necessary for me to create two separate templates: one with stylesheet, the other with embedded style in the table itself for Excel?
Having a single template with conditional formatting inside would be very messy.
Any ideas?
If you not yet solve the problem I'll recommend you to use Open XML SDK 2.0 for Microsoft Office (see http://www.microsoft.com/downloads/details.aspx?FamilyID=c6e744e5-36e9-45f5-8d8c-331df206e0d0&displaylang=en). With this way you will be able create an XLSX file without installing Excel on the server. XLSX file is compressed (like ZIP file) collection of xml files. Open XML SDK 2.0 helps you create and change XLSX file as pure xml files. At the first time if you look at Open XML SDK a lot of things look like strange, but it's only at the beginning. There are so named "Open XML SDK 2.0 Productivity Tool" (a part of Open XML SDK 2.0) which can generate a lot of useful code for you. Moreover you can create a nice Excel document which you can use as a prototype (template) of the document which you will create. So you can solve the problem of complex formating without writing of a lot of code.
Look at http://msdn.microsoft.com/en-us/library/cc850837(v=office.14).aspx for some examples and on http://openxmldeveloper.org/default.aspx. See also Creating Excel document with OpenXml sdk 2.0 as a start example. You can find also a lot of good stuffs on http://www.codeplex.com about Open XML SDK
there are several aproach
you could instantiate a excel object on your server using VSTO, and then write the document on memory and write to response the native file, but this aproach could be a litle expensive if you create a excel object per request, so you could try to do a singleton object that wraps the excel object instance
You can create a report (rdlc file) with a similar look to the grid. Then, you can have an action where you instantiate a LocalReport, pass the data you want to it and call its Render method. You then return the byte array returned by the Render method.

See images in SSMS?

I was browsing around and found this blog post:
http://erikej.blogspot.com/2010/04/version-3-of-exportsqlce-now-available.html
(It is for a great add in if you user SQL Server CE.)
On that post I saw an screen shot of SSMS with images in the results.
How is this done? I have images in my database (PNG files that are serialized via memory stream), but I just see numbers when I select the image column.
If you are asking how this is done, I'm not sure how it is implemented exactly. I know that you can create ssms plugins in visual studio, and I'm sure that there is a way to take a filestream object and decode it.
If you are looking for a way for you to do this besides the plugin you mentioned, there is a great freeware plugin I use. You can find a plugin ssmsboost at http://www.ssmsboost.com. This plugin has a community version and a pro version. The only difference between the two is that the community version needs to be renewed every 120 days. This plugin has a lot of nice features, but the one you're asking for is
SSMS Results Grid Visualizers:
Feature allows to export & view files or some big amounts of text or XML data from tables (like files from document storage of sharepoint services). Required data should be simply output to ResultsGrid. By right-clicking the cell with required value and selecting "Visualize As->.." you can tell to save data to file with predefined name and open it with custom or default application. No matter than SSMS truncates long data from VARBINARY/VARCHAR fields when outputing them to ResultsGrid: SSMSBoost works with internal storage of SSMS and extracts complete cell value. Below you can see how a picture from [LargePhoto] field of [Production].[ProductPhoto] table from [AdventureWorks] database is being visualized:
I'd like to recommend the MiniSQLQuery browser that is free and opensource to achieve this.
http://minisqlquery.codeplex.com/

Excel file to be restricted from opening with any other formats

I would like to know that i have an excel file with 18 sheets and it should be opend with any other versions.
for example if i right click on the file and select open with open office the same is being opened. i would like to lock this.
not possible.
The user or OS decides which programs to invoke.
The best you can do is to obfuscate the data from being read, except with the correct program.
That's not strictly correct. You could create a macro that is tied to the Workbook_Open event that checks to see which version of Excel is being used (i.e. Application.Version). For example, you could try doing something like the following:
Private Sub Workbook_Open()
If Int(Application.Version) <> 11 Then
Workbook.Saved = True
Workbook.Close
End If
End Sub
However, this won't work if users have macros disabled and I have no idea whether it would work on OpenOffice either. I do know that OpenOffice has a VBA equivalent, but don't know enough about the object models to say whether an Excel macro will behave the exact same way in OpenOffice.
I suspect that the best option is to password-protect your workbook and include a macro that checks to see which version is being used. Not a fool-proof approach but probably the closest you're going to get.

Resources