473,327 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

ArgumentException: Invalid file format.

Can someone please tell me why i am getting an invalid file format
exception? here is the code:

string temp = rtbRTF.Rtf;

if (temp.Contains("<font") || temp.Contains("<b>") || temp.Contains("<i>")
|| temp.Contains("<P>") || temp.Contains("<br>"))

{

int start, x;

start = x = 0;

string sub;

while ((start = temp.IndexOf("<font color=#", start)) != -1)

{

x++;

start += 13;

sub = temp.Substring(start, temp.IndexOf(">", start) - start);

GetRGBFromHex(sub);

temp = temp.Replace("<font color=#" + sub + ">", "\\cf" + x.ToString());

start = temp.IndexOf(">", start) + 1;

}

temp = temp.Insert(0, clrtbl);

temp = temp.Replace("</font>", "\\cf0");

temp = temp.Replace("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "\\tab");

temp = temp.Replace("</i>", "\\i0");

temp = temp.Replace("<i>", "\\i");

temp = temp.Replace("</u>", "\\ul0");

temp = temp.Replace("\\ul0", "\\ulnone");

temp = temp.Replace("<u>", "\\ul");

temp = temp.Replace("</b>", "\\b0");

temp = temp.Replace("<b>", "\\b");

temp = temp.Replace("</P><P>", "\\par");

temp = temp.Replace("<BR>", "\\line");

temp += "}";

rtbRTF.Rtf = temp;

}
Nov 16 '05 #1
0 1024

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: | last post by:
Some time ago I installed VC# 2003, made a small generic project, compile with the allow unsafe flag and I get the error below: "error CS1577: Assembly generation failed -- Unexpected exception...
1
by: halise irak via .NET 247 | last post by:
I get an "ArgumentException: Invalid parameter used at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement)" exception. it is too ridicilious to get such an...
8
by: iyuen | last post by:
I'm having problems with converting a byte array to an image object~ My byte array is an picture in VB6 StdPicture format. I've used propertybag to convert the picture into base64Array format in...
0
by: CroDude | last post by:
Hi all! I have problems when writting bitmap to a byte array and after reading it back form byte to Bitmap object. What I do is this: First I throw Bitmap to a memory-stream and then I write it...
3
by: halise | last post by:
Hi, i am in trouble with an exception in .net platform with c#. The exception thrown is exactly as follows: System.ArgumentException: Invalid parameter used. at...
2
by: Rubycon | last post by:
Hi all, can anybody tell me what he invalid parameter is in this code. When I try to execute the mmioDescendParent I get a returncode 11, meaning that an invalid parameter has been passed. I...
18
by: Atara | last post by:
In my apllication I use the following code: '-- My Code: Public Shared Function strDate2Date(ByVal strDate As String) As System.DateTime Dim isOk As Boolean = False If (strDate Is Nothing)...
9
by: MR | last post by:
I get the following Exception "The data at the root level is invalid. Line 1, position 642" whenever I try to deserialize an incoming SOAP message. The incoming message is formed well and its...
1
by: Timbo | last post by:
Hi all, This is my first message here so i'll try and include all the information that will help you help me out, if possible. Basically I am using C# in ASP.NET 2.0 and have a Repeater...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.