我只是想用RazorPDF创建一个简单的xml布局,但我找不到任何方法来为某些标签设置背景颜色。
这就是我尝试过的,
<paragraph style="background-color:red">
<chunk bgcolor="red">sampletext</chunk>
</paragraph>
我的行动很简单,
public ActionResult Pdf()
{
return new PdfResult();
}
答案 0 :(得分:3)
如果使用表格,backgroundcolor =“#808080”属性设置背景颜色,而style =“color:blue”或red =“0”green =“0”blue =“255”设置textcolor。
<table width="100%" cellpadding="1.0" cellspacing="1.0">
<row>
<cell backgroundcolor="#FFFF00" borderwidth="0.5" left="true" right="true" top="true" bottom="true" size="12.0">
<chunk style="font-family:Times;font-weight:bold;font-size:9pt">
Customer
</chunk>
</cell>
<cell backgroundcolor="#FFFF00" borderwidth="0.5" left="true" right="true" top="true" bottom="true" size="12.0">
<chunk style="font-family:Times;font-weight:bold;font-size:9pt;color:blue">
Customer
</chunk>
</cell>
<cell backgroundcolor="#FFFF00" borderwidth="0.5" left="true" right="true" top="true" bottom="true" size="12.0">
<chunk red="0" green="0" blue="255" style="font-family:Times;font-weight:bold;font-size:9pt">
Customer
</chunk>
</cell>
</row></table>
答案 1 :(得分:-1)
<paragraph style="font-family:Helvetica;font-size:14; border:1px" align="center">
<chunk red="0" green="0" blue="255" >@ViewBag.Title</chunk>
</paragraph>