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?
single-quote on HTML attributes also works. you can write <th colspan='2'>
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 asMohammdReza Keikavousi said.
您可以在任何转义字符之前使用 / 或仅使用单引号,例如:“ I/”m StackOverflow “ else “ Im StackOverflow”
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.