File Format and Extension doesn't match - salesforce

I wrote a code to export the data from a VF page. However, when i try to open download the exported page i get a warning message saying the File Format & extension doesn't match. Please help me resolve this warning message.

Is that MS Excel complaining about file that pretends to be real *.xslx file but actual payload is CSV or even a HTML with <table> in it? Well, not much you can do about it.
Excel can try to parse unexpected content, no idea if you can disable that warning somehow. I doubt you'll be able to really please Excel gods. If you tell it it's *.xslx it'll expect a directory full of xml documents, zipped (make a "real" Excel file, force rename it to *.zip, try to open and you'll see what I mean). You won't be able to make a zip file with pure VF and Apex, maybe with some crazy JavaScript libraries...
Just dismiss the warning and move on? Or generate CSV?

Related

ePub mimetype - anyone encountered a situation where it's needed?

I'm wondering if anyone has ever encountered a situation where it was necessary that the mimetype file be put into the zip file first (and uncompressed) to make the ePub work. And I'm not talking about the ability to pass an ePub validation.
I've been trying to write a script to create ePubs and it's not working. I tried several variations of the 7zip flags and every time the validation complains about the mimetype file.
I got fed up and just opened one of the files in Digital Editions and it worked fine. Then opened it in Calibre, dropped it into Chrome (ePub Reader), in iBooks, and even made a Kindle file. Everything worked as expected without throwing up an error.
Is there any situation where this matters...apart from the OCD part of me wanting an error-free file?
The answer appears to be "no"...
But here are a sampling of posts fighting with the Mimetype file error:
Make MIMETYPE file the first file in an EPUB ZIP file?
Creating an Epub file with a Zip library
creating *.epub with perl Archive::Zip -- epubchecker error
How to create ePub with System.IO.Compression.ZipArchive?
The mimetype file has an extra field of length n. The use of the extra field feature of the ZIP format is not permitted for the mimetype file

How to write output error of console in xls format file in selenium-webdriver

If we want to Print the output Bug of a script in a xls file, So is there any way to achieve it?
Pls see the screenshot
The error displayed on console is an assertionerror or exception which you can capture either using any testng listner or try-catch block (Dirty way). once you have the message (error) then write it to excel file (As you already know how to write to excel I will skip this). Note: TestNG Listner also tells you which test failed with some other cool details you can use that info as well to print that info to spreadsheet. Let me know if you need further help!

extract .bin files

So I have an old dictionary on my pc, pretty old that I cannot find
any track of it's developer or the website (I guess it hasnt even been released
as an official software). I have a personal project of mine and I might need some
of this words translated (about 200-300) and I see that inside the data folder that
contains the database/list of files but Im unable to extract or read this files.
Is there any way to extract or convert these .bin files to a text format or something
readable. I've used some tools like (alcohol 120%, isobuster, magiciso, Izarc) but with
no luck. I keep getting and error message saying it is not a valid cd image file.
So I'm thinking maybe this type of .bin files are not like .bin or .iso cd files that
you can mount and read and something else might be in this case.
If you have any information kindly reply with
your suggestions.
Thank you alot.
You can try using the strings utility to extract the strings out of the file. It comes with any Linux distribution and if you are on Windows, you can get it from Windows Sysinternals.
If you are lucky and the words are not encoded, you may be able to get at the data you are looking for.
.bin is one of those extensions that has been way overused, and could be anything... What did the file come from originally? Do you need to convert these words and store them back in the original file (in their transformed form), and then expect the original app to work correctly?

Exporting silverlight datagrid to excel file without warning message

The xls file opens fine and the data is correct but each time I open the file, the warning:
"The file you are trying to open, [filename] is in a different format... Verify that the file is not corrupted..."
pops up. I've read that there is no cleaner workaround to this except tweaking the registry/group policy to 'suppress' the message. But then, this doesn't appear on real xls files made from excel.
So is there a way/format that excel will open the file without this warning message? Should exporting the datagrid to xml/csv work?
found the answer same day, forgot to post the answer as soon as I got it working.
Here's a handy library to help create and read excel files properly. Works on SL4 but you could just tweak the source code to make it usable in SL3
http://excellite.codeplex.com/

Automate download of file dynamically generated by http request

I am trying to automate the download of a bunch of csv files that are generated from a database based on which checkboxes are selected on a form. The website generates the csv file with the click of a 'Download' button. I found the URL to the download prompt using Firebug (and determined how it changes based on checkbox selection), but am unsure how to use it since it is dynamically generated and does not contain a file path. An example URL is the following:
https://www.quantcast.com/download/plannerCSV?&d0Id=10&sc=1&mr=10000
What is the best way to go about doing this? I looked into the Python mechanize module and briefly glazed over pydermonkey, but had trouble finding documentation on downloading dynamically generated files. I also found some suggestions on other forums for using VBscript and Perl-- I prefer to use Python if possible since I am most familiar with it, but if another language is more appropriate, I will learn what I need in order to accomplish this task--I just hope to do it efficiently! Comments from anyone with experience/knowledge/insight on this topic would be appreciated.
Probably the easiest way for you to do this is to use the command line tool wget. If running a UNIX/Linux it's already there. If you're running Windows then a Win32 version can can be downloaded from: http://gnuwin32.sourceforge.net/packages/wget.htm
The you can use a shell/batch script that will download the file for you.
Example for Windows:
set id=10
set sc=1
set mr=10000
set my_url=https://www.quantcast.com/download/plannerCSV?&d0Id=%id%&sc=%sc%&mr=%mr%
set filename=planner.csv
wget %my_url% --output-document=%filename%
:
: do stuff with file
:

Resources