|
-
Feb 22nd, 2009, 06:18 PM
#1
Thread Starter
Fanatic Member
[Resolved] Store HTML code as string?
Is there a more efficient way of doing this than adding &""""& for every double quotation mark in the html code when building the string? I need to store the HTML code as a string. I am finding "[tablerow]" within an existing document with StreamReader and want to replace it with my string value (html code) when writing it back using stringwriter.
Last edited by hipopony66; Feb 25th, 2009 at 03:20 PM.
Reason: Resolved
-
Feb 22nd, 2009, 06:30 PM
#2
Re: Store HTML code as string?
If you do two quotes "" inside of a quote, then it will read that as a single quote to be put in the quotes. Example:
Code:
Dim s As String
s = String.Format("""{0}""", "somevalue")
MessageBox.Show(s)
-
Feb 22nd, 2009, 08:48 PM
#3
Thread Starter
Fanatic Member
Re: Store HTML code as string?
Hmmm. It still does not appear to like that. I am dealing with multiple HTML properties in the string, so there are lots of ""'s. Here's what I've got now:
Code:
strRowToAdd = (String.Format("""{0}""", "<tr><td width="16%"><div align="center" class="style4">[procedure]</div></td><td width="16%"><div align="center" class="style4">[date]</div></td><td width="16%"><div align="center" class="style4">[surgeon]</div></td><td width="16%"><div align="center" class="style4">[surgphone]</div></td><td width="16%"><div align="center" class="style4">[facility]</div></td><td width="20%"><div align="center" class="style4">[postop]</div></td></tr>"))
Thanks for any suggestions. This appears to be fairly tricky.
-
Feb 22nd, 2009, 09:45 PM
#4
Thread Starter
Fanatic Member
Re: Store HTML code as string?
I ran across this article, but am still a little confused regarding the syntax:
http://www.camelsquadron.com/forums/...?a=topic&t=173
-
Feb 23rd, 2009, 08:02 AM
#5
Re: Store HTML code as string?
If you are just building a large string with no replacement values, then forget about String.Format. Inside your string, replace every double quote with two doublequotes.
Code:
"<tr><td width=""16%""><div align=""center"" ...
-
Feb 25th, 2009, 03:19 PM
#6
Thread Starter
Fanatic Member
Re: Store HTML code as string?
Thanks Negative0, I got things working........all the double quotes had me cross-eyed!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|