Reputation: 81
I am adding a table with html:
string _table = @"{
""version"": {""number"": 2},
""type"":""page"",
""title"":""Table"",
""space"":{""key"":""" + postdata.key + @"""},
""body"":{""storage"":{""value"":""<table><tbody><tr><th><p><strong>Project Basic Informations</strong></p></th></tr></tbody></table>"",""representation"":""storage""}}
}";
And I want to style <th>
with colspan="2"
so the header spans two columns.
I tried the following but it doesn't work:
""<table> <tbody> <tr> <th colspan=""2""> <p><strong>Project Basic Informations</strong></p> </th>....""
or <th colspan=\"2\"
Is there a way to escape the double-quotes and get the <th>
colspan attribute to work?
Upvotes: 2
Views: 90
Reputation: 39
Just put the \ inside the string:
string table = "\"<table><tbody><tr><th colspan = \"2\"><p><strong> Project Basic Informations</strong></p></th>....\"";
Or you can use the ascii code of the double-qoute:
char quote = (char)34;
string table = quote + "<table><tbody><tr><th colspan = " + quote + "2" + quote + "><p><strong> Project Basic Informations</strong></p></th>...." + quote;
Or you can use single-quote as MohammdReza Keikavousi said.
Upvotes: 1
Reputation: 65
You can use / before any escape characters or else simply use single quote eg: " I/"m StackOverflow " else " I'm StackOverflow"
Upvotes: 0
Reputation: 102
single-quote on HTML attributes also works. you can write <th colspan='2'>
Upvotes: 3