2014-02-13 4 views
0

Outlook을 통해 전자 메일로 보내지는 HTML 테이블로 목록의 서식을 지정하는 C# 응용 프로그램이 있습니다.HTML 테이블 서식 지정

내가 가진 문제는 다소 간단하지만 해결할 수 없습니다. 난 그냥 전체 테이블의 글꼴 크기를 변경하고 싶습니다. 내가 뭘해도 글꼴 크기는 변하지 않습니다. 내 코드는 아래에 있으며 나는 그게 꽤 아님을 알고있다!

string htmlHeader = "<table><font-size=3;><tr><th align='left'>Sedol</th><th>&nbsp;</th><th align='left'>Name</th><th>&nbsp;</th><th text-align:left>Ex Date</th><th>&nbsp;</th><th align='left'>Dividend Type</th><th>&nbsp;</th><th align='left'>Dividend Contribution</th><th>&nbsp;</th><th align='left'>Dividend Value</th><th>&nbsp;</th><th align='left'>Currency</th><th>&nbsp;</th><th align='left'>Country of Incorp</th><th>&nbsp;</th></tr>";    
string msgBody = htmlHeader; 

for (int i = 0; i < bbergList.Count; i++) 
{ 
    string caText = "<tr><td>" + bbergList[i].Sedol + "</td><td>&nbsp;</td><td>" 
         + bbergList[i].Name + "</td><td>&nbsp;</td><td>" 
         + bbergList[i].dtEx.ToString("dd-MMM-yy") + "</td><td>&nbsp;</td><td>" 
         + bbergList[i].DividendType + "</td><td>&nbsp;</td><td>" 
         + bbergList[i].DividendValue.ToString("#,0.####") + "</td><td>&nbsp;</td><td>" 
         + bbergList[i].DividendAmount.ToString("#,0.####") + "</td><td>&nbsp;</td><td>" 
         + bbergList[i].DivCurrency + "</td><td>&nbsp;</td>" 
         + bbergList[i].CountryInCorp + "</td><td>&nbsp;</td></tr>"; 
} 

StringBuilder sbFinish = new StringBuilder(); 
msgBody = sbFinish.Append(msgBody).Append("</font></table>").ToString(); 
+0

'은'사용되지 않습니다. CSS를 사용하여 테이블의 글꼴 스타일을 지정하십시오. – Candide

+0

CSS를 사용하여 C#에서 글꼴을 스타일 화하는 방법은 무엇입니까? – mHelpMe

+1

"* .css"파일에서 인라인' – Candide

답변

2

이 같은 것을 사용할 수 있습니다

<table style="font-size:14px"> 

당신은 당신이 원하는대로에 글꼴 크기를 설정할 수 있습니다.

<tr style="font-size:14px"> 

열 경우 : 행의 경우

<td style="font-size:14px"> 
0

당신은 C#을 사용하여 텍스트의 서식을 시도 여부를 알 수는 없지만, 당신이 원하는대로 HTML 코드로 게시 html 태그를 사용하여 형식을 지정하는 것이 좋습니다.

아래 첨자 등의 텍스트 서식 지정에 대한 다른 예는 다음에서 찾을 수 있습니다. http://www.w3schools.com/html/html_formatting.asp

그리고 당신은 색상을 변경하려는 경우,이 예제는 도움이 될 수 : http://www.w3schools.com/tags/att_font_color.asp

obove 사이트 :

<font color="color_name|hex_number|rgb_number"> 

사용 <font color="red">This is some text!</font>는 붉은 색 글꼴을 얻을.

안부,

마커스