Author: nicdex

Exporting html to excel 2003 and 2007 using utf-8

Using html in Excel is very usefull, because it allows to do easy reporting with nice features like colors, tabular formatting, etc.

First we need to output some headers so the browser will open the ouput with Excel. This works in both 2003 and 2007 :

(pseudo-code)
headers.Add(“Content-Type”, “application/vnd.excel”)
headers.Add(“Content-Disposition”, “attachment;filename=something.xls”)

The tricky thing was the output encoding. In utf-8, it worked in 2007, but not in 2003. In utf-7 it worked in 2003, but not in 2007. In unicode, it did not work at all.

After alot of tries, I finally discovered, that the output must be in utf-8, but we need to output the UTF-8 BOM wich identify the utf-8 byte order. Then it worked perfectly. You need to output this at the beginning of your data :

(pseudo-code)
OutputStream.WriteByte(0xEF);
OutputStream.WriteByte(0xBB);
OutputStream.WriteByte(0xBF);

exceptions and threads with mingw

If you’re having trouble using exceptions and threads with MingW, here is the solution:

1. Add these compiler options:
-mthreads (enable exception support in threads)
-fexceptions (enable exception handling)

2. Get the latest version of gcc (I have the 4.4.0, see the g++ -v ouput below)

It is very important that you check your gcc version and configuration (-v), because the last version I had 3.4.0 did not work even with the -mthreads.


Using built-in specs.
Target: mingw32
Configured with: ../gcc-4.4.0/configure --enable-languages=c,ada,c++,fortran,jav
a,objc,obj-c++ --disable-sjlj-exceptions --enable-shared --enable-libgcj --enable-libgomp --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --prefix=/mingw --with-gmp=/mingw/src/gmp/root --with-mpfr=/mingw/src/mpfr/root --build=mingw32
Thread model: win32
gcc version 4.4.0 (GCC)

I lost a lot of time trying to debug/fix this, so I hope this helps.

X1office.com

X1office est un nouveau service offert par l’entreprise où je travaille. Le type de clientèle visée est la petite et moyenne entreprise.

Voici un résumé des services offerts:

– Boite de courriel Outlook 2007 avec serveur Exchange.

– Service de sauvegarge des données.

– Service Sharepoint.

– Service de synchronisation des mobiles Blackberry.

Vous pouvez voir plus en détails les services offerts sur le site web de X1office au http://www.x1office.com.

Voila 😉

Using dynamic canvas creation with google excanvas using IE

When you are using IE and ExplorerCanvas, dynamically created canvas with document.createElement are not working. They’re are not extending the ExplorerCanvas functionnality by default.

Include this script after excanvas.js in your html header to extend the created element at creation:

if ( /MSIE/.test(navigator.userAgent) )
{
document._createElement = document.createElement;
document.createElement = function( tag )
{
var element = document._createElement( tag );
if ( tag == “canvas” )
{
//width and height are required for initElement
element.width = 1;
element.height = 1;
G_vmlCanvasManager.initElement(element);
}

return element;
}
}

Now you’re dynamically created canvas will actually work. This is surelly not the best way to do it, because of performance overhead, but at least it works. Plus, you rarely use tons of canvas in the same document.

if ( /MSIE/.test(navigator.userAgent) )
{
document._createElement = document.createElement;
document.createElement = function( tag )
{
var element = document._createElement( tag );
if ( tag == “canvas” )
{
//width and height are required for initElement
element.width = 1;
element.height = 1;
G_vmlCanvasManager.initElement(element);
}

return element;
}
}

Reportage sur mon employeur

Voici les trois reportages qui ont été réalisé sur PCMS Conseil, l’entreprise pour laquelle je travaille.

http://www.radio-canada.ca/audio-video/pop.shtml#idMedia=0&urlMedia=/Medianet/2007/RDI2/Telejournal200707262100_1.asx

http://www.radio-canada.ca/audio-video/pop.shtml#urlMedia=http://www.radio-canada.ca/Medianet/2008/CBFT/TelejournalMontreal200802251800_3.asx

http://www.radio-canada.ca/audio-video/pop.shtml#urlMedia=http://www.radio-canada.ca/Medianet/2009/RDI2/TelejournalSurRdi200904231700_4.asx