My first open source project Office Open XML C# Library

Hey all,

Well today i finally started my own Open source project witch is called "Office Open XML C# Library".

The purpose of this project is to create a Library witch will allow c#(.Net 2.0) programmers a easy interface with the new File format of Office 2007.

As a start i created a basic interface for word documents (*.docx) witch is in the Alpha fase. This interface is not great Yet but it will to some of the basic thinks like reading and writing :).

In the end the Library will support all the Open Xml files like "Docx", "xlsx" and the rest of it all.

One of the problems with the first alfa is you can't create a docx from scratch yet.

Well i hope some people think this is a good idee :D.
If to please visit http://officeopenxml.sourceforge.net and try it out

Happy Netting,
Warnar

I Love Scutt

Hi all,

I just wane say subscribe to this blog: http://weblogs.asp.net/scottgu/ (if you havent allready)
And some more information you really need to take a look at http://weblogs.asp.net/scottgu/archive/2006/05/08/445742.aspx it's web applications back a well it has been back for a while i'm just late blogging.

Happy netting!

Embedded Images in Html Follow Up

Hi all,
A while ago i wrote about embedded images and stuff and like it aint great for big files.
Well notting has changed for the but.
To give you a small idee on how to get some sort of a dynamic image out of object idee you might wane think about something like this:
Create a webpage.
Override the render with the one of the image you want to render.
Load the image using some query or post paramters the paramter you might wanne use are type (The fullname of the object), property (The property witch returns the image/bitmap) and a id with you may need for a DAO or something like that.
Use some reflection adn have fun.

Just a idee you might beable to use.
Happy netting!

O yeah you might also look at https://sourceforge.net/projects/ie7/ for some idee's.

Object to DataTable

Hi all, Did you ever had the problem that u just wanted your object in a datatable and didn't wane hardcode the datatable if so this may help:

#region ObjectArrayToDataTable
        internal static DataTable ObjectArrayToDataTable(object[] obj, Type type)
        {
            return ObjectArrayToDataTable(obj, type, null);
        }
        internal static DataTable ObjectArrayToDataTable(object[] obj, Type type, DataColumn[] extra)
        {
            DataTable dt = new DataTable();

            foreach (PropertyInfo pi in type.GetProperties())
            {
                if (pi.PropertyType.IsPrimitive || pi.PropertyType == typeof(string) || pi.PropertyType == typeof(DateTime))
                {
                    dt.Columns.Add(pi.Name, pi.PropertyType);
                }
            }

            if (extra != null)
            {
                foreach (DataColumn c in extra)
                {
                    if (dt.Columns.Contains(c.ColumnName))
                        dt.Columns.Remove(c.ColumnName);
                    dt.Columns.Add(c);
                }
            }

            foreach (object k in obj)
            {
                DataRow dr = dt.NewRow();
                foreach (PropertyInfo pi in type.GetProperties())
                {
                    if (pi.PropertyType.IsPrimitive || pi.PropertyType == typeof(string) || pi.PropertyType == typeof(DateTime))
                    {
                        dr[pi.Name] = pi.GetValue(k, null);
                    }
                }
                dt.Rows.Add(dr);
            }

            return dt;
        }
        #endregion

I wish you all happy netting!

Embedded Images in Html

Hello to all,

 

I havend blogged since a long long to but I gess I need to start again so here I go.

 

A colleague of mine was working on a html report for a windows application and had the problem then he needed to have a embedded image (this mean he doesn’t want to link to a image location using <img src=””> but just a string or something to display the image).

The problem with this is that he found the ‘OBJECT‘ tag in witch you can give a base64 encoded image but this won’t work in IE!

 

So after some searching from my side I found the following site http://bennherrera.com/EmbeddedImage/ witch show’s that with a encoded string and JavaScript you can embed a image. This is really nice but the encoding of the string  (witch originally was done in java) takes a long time ( it also took along when I  converted the java to c#). So this was not really the answer for me (Bummer).

 

But with the JavaScript source I was seeing that it is possible to use tables to create a embedded image. The bummer with this off course is that you will get a Huge html file and that the browser can go hang. But still this is about the only way to embed a image in your HTML. So I created a small class with three different types of creating a table the first method is called ‘ToPlainHtml’ will take the image and create for every pixel a cell with a background color that is needed, This will create a huge HTML file even if the entire image is black.

So I started to optimize the code an came up with the method called ‘ToOptimistedHtml’ this method differs In that it uses ‘colspan‘ in the cells if the color is the same as the last color. But this will still create a lot of “bgcolor=’#HexColor’” so I wanted to use CSS.

So the final and best optimized method (this using css/html and my brains) is ’ToOptimistedHtmlWithCss  this will use ‘colspan’ in the table cells, ID’s so set the color and will use the most used color as table background. (All the functions work in IE, Firefox and opera)

 

Anyway I hope some of you can use this code it took me some time to figure out but it was nice. Also a word of Warning  Don’t use this for big images because The Browser Will Hang!

 

Happy netting,

Warnar boekkooi

 

The Code:

http://www.bulgarije-verkeersbureau.nl/Class/EmbeddedImage.zip

IE7 faker ;)

Hey all,

A very nice project that makes it possible to use some css 2 and 3 in ie is:
http://sourceforge.net/projects/ie7/
Just in case your wondering there are htc files that can do some of the thinks that ie7 will also do like:
http://webfx.eae.net/dhtml/boxsizing/boxsizing.html
and some others but i dunno witch exactly

Happy netting,

Warnar

Border-radius in IE

Hi all,

Long time since i posted but well i should do it so here i go again i think :D
I was working on a site that needed rounded borders that could change color on the fly so for mozilla i found the css propertie -moz-border-radius but this didn't work so after some searching i found a hack i dunno where exactly anymore but here is the htc file that you should use if you wane let ie be possible to use a border radius:

- htc file
- html preview file

hope this help some ppl

Happy netting,

Warnar

Make IE and Mozzilla look the same (2 tips)

Hi all,

So i was building my cms system and finally i found out what was wrong and why a site looked so mutch differend in IE then in Mozzila.
The problem is the Box model used by IE the official box model by W3C is with of the content but IE uses the width of the border.
To fix this is pritty easy just dump IE! No just kidding there is a very nice think make by Erik Arvidsson witch will make the images with borders look the same in IE and Mozzilla. The site where you can read about this is: http://webfx.eae.net/dhtml/boxsizing/boxsizing.html

Also what really f*c*s sites up is the user of the css properties 'font-size' used with one of the following values:

  • xx-small
  • x-small
  • small
  • medium
  • large
  • x-large
  • xx-large

Just use number as values like '12px' or '16px'.

These 2 tricks really helped me create a system that makes the sites look almost the same.

Happy netting,
Warnar Boekkooi

No connection could be made because the target machine actively refused it

Hi all i had the following error:

After i upload the FTP component edtFTPnet (from http://www.enterprisedt.com/) to my webserver.
This error seemed to have been made by the server because it was blocking the 21 port that way the ftp component did not allow the connection.

Happy netting,
Warnar

Trillian Public Alpha

The trillian team has started alpha testing the new trillian.
I have been invited for this it is pritty kewl only problem i found until now is I WANT MY OLD SKIN :D:D
Anyway i still need to get a new pro version of trillian but i'm not sure if i will do it there are no reall new things exept the history that i need.

Anyway there are allready download with cracks all around the net so if you want to test it your self it is allready possible but i think that you can better buy it.

I went to Technet

Last wensday i went to my first technet confirence :D with my Mentor ;)
It was very nice lurned alot about the new .NET and SQL :D:D
My favorite presentation was about Smart Clients.
On the link below you can download the presentations:
http://www.microsoft.com/netherlands/evenementen/technetmsdn/presentaties.aspx

Thanks Peter hope we can do this again :D

Happy netting

Arraylist to String[]

Hi all,

Just had the problem of that i needed to make a arraylist to a string array this is the way i did it:

string[] test = frames.ToArray(Type.GetType("System.String")) as string[];

In this case frames is the arraylist;

Need some book advise

Hi all,

I have been working with javascript alot the last couple of weeks but what i'm mizzing is a good book.

So i was just wondering if any knows a good reference book for javascript (also JScript) because using the internet is not always great.

So thanks allready.

Happy scripting,
Warnar

Javascript Style Sheet change function

Hey all,

The last couple of hours i have been bizzy with some stupid control that i needed that could change the background color, font color and stuff of a StyleSheet so here is the result (i tested it in Firefox and IE):

function StyleSheetChanger(cssClassName,toChange,changeTo)
{
 for(i = 0; document.styleSheets.length > i; i++) //Mozilla
 {
  if(document.styleSheets[i].rules != undefined)
  {
   for(j = 0; document.styleSheets[i].rules.length > j; j++)
   {
    if(document.styleSheets[i].rules[j].selectorText.toLowerCase() == cssClassName)
    {
     document.styleSheets[i].rules[j].style[toChange] = changeTo;
    }
   }
  } else if(document.styleSheets[i].cssRules != undefined) //IE
  {
   for(j = 0; document.styleSheets[i].cssRules.length > j; j++)
   {
    if(document.styleSheets[i].cssRules[j].selectorText.toLowerCase() == cssClassName)
    {
     document.styleSheets[i].cssRules[j].style[toChange] = changeTo;
    }
   }
  } else
  {
   window.alert("Your browser won't support the changing of a style sheet by javascript!");
  }
 }
}

The way that it works is that it will go true all the Style's you have and look for the cssClassName (or what ever it is called) like Body or .MyStyle and change the the propertie of it that you wane change like the background and that's it.

btw dues any one know a good edit for JavaScript because i hate using notepad for stuff like this.

Happy Netting,
Warnar

Stupid OleDbCommand.Parameters

Hi all,

Men i have been f*cking up today i had some nice OleDbCommand lbut one way or the other the paramaters didn't work right it looked like this:

OleDbCommand SelectCommand = new OleDbCommand("SELECT DesignID, Name, TextColor, BackGroundAlign, BackGroundColor, BackGroundImage, BackGroundRepeat FROM DesignFrames WHERE (DesignID = ?) AND (Name = ?)",this.oleDbConnection1);

SelectCommand.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Name", System.Data.OleDb.OleDbType.Integer));

SelectCommand.Parameters.Add(
new System.Data.OleDb.OleDbParameter("DesignID", System.Data.OleDb.OleDbType.Integer));

After spending about 1 hour i find out that with OleDbCommand the order of the Parameters mather so great yet another hour wasted on notting. My code now looks like this:

OleDbCommand SelectCommand = new OleDbCommand("SELECT DesignID, Name, TextColor, BackGroundAlign, BackGroundColor, BackGroundImage, BackGroundRepeat FROM DesignFrames WHERE (DesignID = ?) AND (Name = ?)",this.oleDbConnection1);

SelectCommand.Parameters.Add(new System.Data.OleDb.OleDbParameter("DesignID", System.Data.OleDb.OleDbType.Integer));

SelectCommand.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Name", System.Data.OleDb.OleDbType.Integer));

Happy Netting,
Warnar Boekkooi

Got gmail weee

I just got a gmail account thanks to Greg Duncan (http://coolthingoftheday.blogspot.com/)
Time for testing :D:D

Happy netting,
Warnar Boekkooi

I HATE ASP

Ok i have one Small statment I Hate Bad writen Asp witch is only readable by the programmer who wrote it.
Second i hate to have to intergrate a ASP.NET system that i wrote into one of the 3 versions after that made me clear that all versions where about the same and finding out after making a great intergration into one version that the other two are totaly diffrend.

O yeah one last think ASP.NET is a 100000000000000000000000000000% better then ASP (this is a personal oppinion)

Happy Netting,
Warnar

Internal Compiler Error: stage 'BEGIN'

Strange error:
Internal Compiler Error: stage 'BEGIN'
and a lot more this because some enum i use the problem was that i typed Database.NameOfTheEnum.Option1 where Class was defined as Database.DB Class = new Database.DB()
But i didn't know that i just couldn't access a enum like that.
The way to access one is Database.DB.NameOfTheEnum.Option1 if you get my point hope you do.

Happy netting,
warnar

I have a new display

W00T i got a new display a Iiyama HM903DT B Vision master Pro 454.
It is great :) only bummer is that the USB hub on it is USB 1 and it dues not have a switch so you can switch between to pc because there is a way to get two pc connected to the display :))

Happy netting,
Warnar

CS1607: Assembly generation -- Referenced assembly 'DataBase' is a localized satellite assembly

Got the following error while working:
CS1607: Assembly generation -- Referenced assembly 'DataBase' is a localized satellite assembly

I was the [assembly: AssemblyCulture(””)] witch i had changed to [assembly: AssemblyCulture(”nl”)]

Happy netting,
warnar