How to avoid Excel startup (format warning) error when opening XLS created document via script (Solaris,sqlplus script) - format

From Unix script, an XLS-document is created via sqlplus; then successfully delivered as an attachment to Outlook; XLS-formatted attachment opens but initially prompts and displays warning before opening (format wrong message"). In going for full automation, is there a descriptor, keyword or definition which be placed in the output file to eliminate the warning? Excel=2016

Related

Printing on the FILE port with a given output path still shows the "save as" dialog

My application uses GDI printing to create postscript files then converted to PDF.
My printer use Ghostscript PDF driver and the FILE port
(By the way why it is named "PDF driver" if it cannot output pdf directly)
I specify a file output path with the DOCINFO struct docInfo.lpszOutput = L"c:\temp_path\{guid}.ps";
Everything works fine. But sporadically the driver prompt the "save as" dialog, despite I provided an output filename.
The program runs server side so this prompt dialog is problematic.
Why does this happen?

Open an already opened (by others) Excel file with BATCH

I have a BATCH code, which perfectly opens an EXCEL file:
START "C:\office\excel.exe" "C:\tmp\file.xlsx"
BUT: If someone else opens this EXCEL file (via network) and do not close it --> he leaves it opened, then I cannot open this file using my BATCH.
If I click on the EXCEL file, and press ENTER (so opening using windows not batch), the file will be opened, but it alerts me that someone else is locked this file, but I can open it to read or I can request a notice if the other person closes the file.
How could I set in BATCH file, to open the EXCEL (or WORD) file (only for reading) even if it is opened by others (via network)?
The solution is: leave the START command:
"C:\office\excel.exe" "C:\tmp\file.xlsx"

Exception with Excel SaveCopyAs() method

I have generated a excel report using excel-addins in vs2010 and it saved to desktop. After that I reopened the same file and changed it's data. When I tried to save back with same file name Exception occurs.
Code:-
Globals.ThisAddIn.Application.ActiveWorkbook.SaveCopyAs(saveFileDialog1.FileName);*
Exception:-
System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Excel cannot access the file 'C:\Documents and Settings\112\Desktop\111.xlsx'. There are several possible reasons:
• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook.
Check to see that your file isn't being used by something else.
You are almost certainly hitting a file access exception, probably because the document you are attempting to write is already open in another program.
I'm guessing that program is Microsoft Excel.
Close the document in Excel and re-run your test.

Excel .xlsx download - sharing violation error message on Open and Save combination

I've found this question posed a few times, but no definitive answers as yet. Looks like a decent solution would help quite a few people.
So we create an excel file (.xlsx) on the server and download it to the client using content-disposition 'attachment'. The Open Save dialog appears and all works fine if you choose Save, or Open and then Save As... However if you choose Open and then hit the Save... button then Excel hangs for a moment and then presents the message:
Your changes could not be saved to 'Export[5].xlsx' because of a sharing violation. Try saving to a different file.
then:
The file you are trying to open 'F8CAC020.IE5\HM2NBE5C\F8CAC020', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?
then:
you finally get the Save As: dialog (assuming you pressed 'Yes').
Code for creating the file is:
Response.Clear()
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
Response.AppendHeader("content-disposition", "attachment;filename=Export.xlsx")
Response.AddHeader("Content-Length", New System.IO.FileInfo(NewFile).Length)
Response.TransmitFile(NewFile)
Response.Flush()
If you remove the content-disposition header you get the right sort of behaviour in Excel, but with the wrong name and no guarantee that the Excel document will not instead be shown in the browser (depending on client settings). If you press Open and then Save then you
get a message:
'default.aspx' is read-only. To save a copy, click OK, then give the workbook a new name in the Save As dialog box.
So the question is how to combine the 2 behaviours into a reasonable one:
Get the nice error message directly above, when you try to Open and then Save a downloaded file, but also specify that the document should be downloaded and given a default filename.
Cheers,
James
I believe there is a bug in the IE file download code that does not acknowledge the completed file transfer (download) from the web server, thus leaving a connection to the downloaded (temporary) file open when the save is attempted. That generates the "sharing violation" message. I tried the same code with FireFox and I don't get the same result, which surely leads me to believe this is an IE-specific problem.
Unfortunately, given that I believe this to be a bug in IE, I don't think there is presently a clean resolution to this issue.

.vcf file not opening

I am trying to create a .vcf file programmatically in C#, and writing a bunch of strings in the correct format in that file. But when i try to open it manually, the following message appears. Could not start Microsoft Outlook.The file maynot exist, you may not have permission to open it, or it may be open in another program.
But when i create a text file manually write the same bunch of strings in the vcard format and change the extension to .vcf and then open the file, it opens properly with outlook
Any help!!!
You don't say so explicitly, so I have to ask: have you elimated all of the suggestions Outlook gives you? The file isn't currently still open with a lock by your program? The file permissions are such that it can be read by the outlook user? The file does exist?
This reply may help someone. I got a similar error, the problem for me was that there was no data in the vcf file. As soon as i printed the VCARD info after the headers (and then opened the resultant vcf file) the error disappeared.
My error
Verify you used CrLf for line terminiators in your code. If you use Environment.NewLine or just \n's, that may be the problem.
You probably saved the file as UTF-8 or Unicode. To test, open the file in VS in binary, delete the first three bytes and see if the file opens.
Had a very similar problem when constructing a .vcf file from a vCard string. The contact form would be completely blank when opening in Outlook. I solved the problem by converting the string to a UTF8 Encoded Byte Array.
byte[] vCard = System.Text.UTF8Encoding.UTF8.GetBytes(vCardString);

Resources