Proper SpreadsheetML file extension - windows

I want to create a a SpreadsheetML file on local drive which can be opened in MS Excel or Open Office by clicking on file in Windows Explorer.
I tried all filename extensions registered to Microsoft Excel i could find so far.
Some of them (.xls for example) allows file to be opened, but after "File is in different format than specified by the file extension" warning dialog. Some extensions (like .xlsx) causes Excel to show format error dialog without opening file.
Wikipedia tells that extension should be .xml, but it is registered to be opened by web browser by default.
This, this and this similar questions are about downloading a file from web and setting proper content-type. But i can not change content-type for local file.
This article explains how this annoying Extension Hardening mechanism works and how to disable it, but i think it is wrong to force user to disable security features just to allow spreadsheet file to be opened.
So there is no solution or am i missing something?

Now Open Office can open .xlsx (and read) files and Excel can open (and read) .ods files. My suggestion is to pick one of them that best suits your audience and your understanding of the specific file format.
Both of the applications have advantages and disadvanges and non-supported features between the two of them.
I suggest reviewing the document Differences between the OpenDocument Spreadsheet (.ods) format and the Excel (.xlsx) format.
When you work with two file formats, like .xlsx and .ods, there might
be formatting differences, and not all features will be available.
You’ll be able to convert data and content, but the way you work with
the content might be different depending on which formats you use.
One gotcha is with Open Office when you save a .xlsx file it will change the format to a .ods file. Both the applications will re-arrange the folder structure after saving anyway.
The biggest change is how you go about creating the SpreadsheetML files, both Open Office and Excel have a different folder structure depending on the file extension you will use.
Here is a short example of an Excel folder format.
-/
- _rels/
- .rels
- xl/
- _rels/
- workbook.xml.rels
- sheet1.xml
- workbook.xml
- [Content_Types].xml
I have created a sample GitHub repository for this with a sample that will open in both Excel and Open Office.
https://github.com/Nico-StackOverflow/proper-spreadsheetml-file-extension

Related

How do I detect where is corrupted in a power point file?

I have a power point file(.pptx) generated by a program that copies xml files and content files in a slide to other slides. It simply extracts xml files and content files from original power point file and then copies xml files, finally compresses the files as a zip file and renames the file to xxxxx.pptx. (The xml files I mentioned here is, of course, about Office Open XML)
When I open this file in Keynote on Mac OS X, it works well. No error happened.
However when I use PowerPoint application on Mac OS X, the app says "PowerPoint found a problem with content in xxxxx.pptx"
I think there are differences between PowerPoint specs and Keynote specs, so I need to apply the generated pptx file to the PowerPoint specs.
But, the error does not say WHERE or WHAT ERROR IS OCCURRED, but says there are some errors in that file.
So I cannot look for where is damaged in the generated file!
How do I detect the errors in the file or validate the format of it?
I do not want to get 'restore tools' but 'error detection tools'.
I simply used Open XML SDK 2.5 Productivity Tool.
In my situation, it said the Content-Type of xml files was different from expected one when I opened the pptx file. Soon, it occurred to me I forgot to change the data in [Content_Types].xml
After I fixed it, the file is opened without problems now!!
This app also shows codes in C# and validate each xml files individually.
Download Link is here ->
https://www.microsoft.com/en-us/download/details.aspx?id=30425

In DBF, "Ñ" character is showed as "¥"

I open a DBF file in Visual FoxPro and it shows "Ñ" character as "¥". I haven't created that DBF, I just open it and read it.
My question is: Is there any way to show those "¥" characters correctly in FoxPro? Or does it mean that this DBF file was created wrongly?
You probably need to know which encoding was used when the file was saved, depending on the version number of the file. Also the MSDN has a dedicated page about this topic. https://msdn.microsoft.com/en-US/library/5b10d8b6(v=vs.80).aspx
In specific the first paragraph might be for your interest:
When you create .dbf files, Visual FoxPro automatically gives them
code page marks so that you can tell which code pages they use.
However, if you use .dbf files from previous versions of FoxPro, they
might not have code page marks. You can determine whether a .dbf file
has a code page mark by using the CPDBF( ) function after opening the
file or by having Visual FoxPro check when you open the file.
You need to set the proper code page of your DBF file.
To know it, open the file with DBF Commander Pro, click 'Tools -> Set Codepage', then try to set the proper encoding by choosing various encodings from the list (leave 'Preview' check box turned on):
The program has 30-day fully functional trial period, so you can do your task at no charge.

How to update a PDF document opened in a viewer on Windows

I am writing a cross-platform application which generates PDF documents and then opens them with the standard PDF viewer. On Linux, updating (re-writing) an already opened document is no problem. The PDF viewer (have tried several) updates the displayed document after overwriting the file. I don't even have to trigger anything. This comes in very handy.
On Windows, however, I cannot overwrite a PDF document opened for reading by some viewer, because the viewers seem to open the document exclusively. Of course I cannot change the code of the viewers like Adobe Reader.
Is there any solution to this? I don't want to clutter the directory with arbitrary new file names, but rather use the same file name again. Deleting of the opened file is also forbidden on Windows.
I cannot determine which PDF viewer is used. In order to open the document, I use
cmd.exe /c start <fileName>

Dynamically changing file lock/access permissions on open file

I have a client application where we try to check files in and out from SharePoint for editing. I am using SharePoint's SOAP interfaces and some FrontPage interfaces to do this. It used to work fine under SharePoint 2007, but with 2010 I can't check out or check in a file if I have the file open for editing. I get a message like "FileXXX is locked for exclusive use by DOMAIN\user" when I examine the returned error message. I also cannot update any of the user defined SharePoint fields for a file/list if the file is open for editing.
My question is this: Is there a way to change the access/lock for an open file to make it non-exclusive temporarily and then restore it?
Note: Some of my data files are opened using windows file handles (flat files) and others are opened using windows structured storage (compound document files).
This may not work for Sharepoint specifically, but the ReOpenFile() API does what you want. I don't know of any other way to do this.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365497(v=vs.85).aspx

Expression Web: Shortcut doesn't point to an exe file, but I want to use it to edit

Problem: I have to support users who need to edit web pages. Some of these web pages exist only as textarea controls. Fortunately, there is a firefox plugin that allows the user to open the textarea in a default text editor. Unfortunately, this plugin requires you to point to the EXE file of the text editor you want to invoke.
This is a reasonable requirement, but ##$%^ Microsoft Expression Web is one of those applications whose shortcut .lnk file does not appear to point to a real EXE file. If there is an EXE file somewhere, it's hidden.
Question:
How can I locate the actual EXE file so people can configure Microsoft Expression web to be their editor of choice?
Update: I should have emphasized that I was looking for a way to automate this via script or batch file (hence the SO posting, in case anyone's "not-programming-related" spidey sense was tingling).
I found my executable in the following location:
C:\Program Files\Microsoft Expression\Web Designer\EXPRWD.EXE
I'm not sure if that gives you what you need, but you can always have your users (or programmatically) search for EXPRWD.EXE and go from there.

Resources