本文整理汇总了C#中System.Web.UI.HtmlControls.HtmlTable.RenderControl方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTable.RenderControl方法的具体用法?C# HtmlTable.RenderControl怎么用?C# HtmlTable.RenderControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.HtmlControls.HtmlTable
的用法示例。
在下文中一共展示了HtmlTable.RenderControl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ASPXToPDF
public void ASPXToPDF(HtmlTable objhtml1, HtmlTable objhtml2)
{
string fileName = "AsignacionFolios.pdf";
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.Clear();
StringWriter sw1 = new StringWriter();
HtmlTextWriter hw1 = new HtmlTextWriter(sw1);
objhtml1.RenderControl(hw1);
StringWriter sw2 = new StringWriter();
HtmlTextWriter hw2 = new HtmlTextWriter(sw2);
objhtml2.RenderControl(hw2);
StringReader sr1 = new StringReader(sw1.ToString());
StringReader sr2 = new StringReader(sw2.ToString());
Document pdfDoc = new Document(PageSize.A2, 5f, 5f, 5f, 5f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, HttpContext.Current.Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr1);
pdfDoc.NewPage();
htmlparser.Parse(sr2);
pdfDoc.Close();
HttpContext.Current.Response.ContentType = "application/pdf";
HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + fileName);
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Write(pdfDoc);
HttpContext.Current.Response.End();
}
示例2: GetDesignTimeHtml
public override string GetDesignTimeHtml()
{
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
HtmlTable t = new HtmlTable();
t.Align = mp.Align.ToString();
t.CellPadding = 2;
t.CellSpacing = 0;
t.BorderColor = ColorTranslator.ToHtml(mp.BorderColor);
t.BgColor = ColorTranslator.ToHtml(mp.BackColor);
t.Width = mp.Width.ToString();
t.Height = mp.Height.ToString();
HtmlTableRow tr = new HtmlTableRow();
HtmlTableCell td = new HtmlTableCell();
td.VAlign = "top";
td.Align = "center";
// inner table for iframe
HtmlTable iframe = new HtmlTable();
//iframe.BgColor = "#FFFFFF";
iframe.Width="100%";
iframe.Height="100%";
iframe.CellPadding = 0;
iframe.CellSpacing = 0;
//iframe.Style.Add("border","1 solid ");
//iframe.Style.Add("border","1 solid " + ColorTranslator.ToHtml(mytb.EditorBorderColorDark));
HtmlTableRow tr2 = new HtmlTableRow();
HtmlTableCell td2 = new HtmlTableCell();
td2.VAlign = "middle";
td2.Align = "center";
td2.Controls.Add(new LiteralControl("<b><font face=arial size=2><font color=green>My</font>Pager:</b> " + mp.ID + "</font> <font size=2>1 2 3 4 <font color="+ColorTranslator.ToHtml(mp.CurrentNumberBgColor)+">5</font> 6 7 8 9</font>"));
tr2.Cells.Add(td2);
iframe.Rows.Add(tr2);
td.Controls.Add(iframe);
//td.Controls.Add(new LiteralControl("<br><br><br>"));
tr.Cells.Add(td);
t.Rows.Add(tr);
t.RenderControl(htw);
return sw.ToString();
}
示例3: TableContentDesigner
public string TableContentDesigner()
{
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
HtmlTable t = new HtmlTable();
t.CellPadding = 3;
t.CellSpacing = 0;
t.BorderColor = "#6699cc";
t.BgColor = "#6699cc";
t.Width = ptbc.Width.ToString();
t.Height = ptbc.Height.ToString();
HtmlTableRow tr = new HtmlTableRow();
HtmlTableCell td = new HtmlTableCell();
td.VAlign = "top";
td.Align = "center";
// inner table for iframe
HtmlTable iframe = new HtmlTable();
iframe.BgColor = "#FFFFFF";
iframe.Width = "600px";
iframe.Height = "500px";
iframe.CellPadding = 0;
iframe.CellSpacing = 0;
iframe.Style.Add("border", "1 solid " + "#6699cc");
HtmlTableRow tr2 = new HtmlTableRow();
HtmlTableCell td2 = new HtmlTableCell();
td2.VAlign = "middle";
td2.Align = "center";
td2.Controls.Add(new LiteralControl("<b><font face=arial size=2><font color=green>Power</font>TalkBox:</b> " + ptbc.ID+ "</font>"));
tr2.Cells.Add(td2);
iframe.Rows.Add(tr2);
td.Controls.Add(iframe);
td.Controls.Add(new LiteralControl("<br><br><br>"));
tr.Cells.Add(td);
t.Rows.Add(tr);
t.RenderControl(htw);
return sw.ToString();
}
示例4: renderGlobalOptions
protected void renderGlobalOptions(HtmlTextWriter writer, Widget_Builder_Options renderingOptions)
{
HtmlTable globalOptionsTable = new HtmlTable();
HtmlTableRow tr;
HtmlTableCell td;
TextBox textBox;
tr = new HtmlTableRow();
globalOptionsTable.Rows.Add(tr);
//max widgets
td = new HtmlTableCell();
tr.Cells.Add(td);
td.InnerText = "Max Widgets Per Property";
td = new HtmlTableCell();
tr.Cells.Add(td);
textBox = new TextBox();
textBox.CssClass = "maxWidgets";
textBox.Text = renderingOptions.maxWidgets.ToString();
td.Controls.Add(textBox);
tr = new HtmlTableRow();
globalOptionsTable.Rows.Add(tr);
//js include
td = new HtmlTableCell();
tr.Cells.Add(td);
td.InnerText = "JS Include Path";
td = new HtmlTableCell();
tr.Cells.Add(td);
textBox = new TextBox();
textBox.CssClass = "jsInclude";
textBox.Text = renderingOptions.jsIncludePath;
td.Controls.Add(textBox);
tr = new HtmlTableRow();
globalOptionsTable.Rows.Add(tr);
//css include
td = new HtmlTableCell();
tr.Cells.Add(td);
td.InnerText = "CSS Include Path";
td = new HtmlTableCell();
tr.Cells.Add(td);
textBox = new TextBox();
textBox.CssClass = "cssInclude";
textBox.Text = renderingOptions.cssIncludePath;
td.Controls.Add(textBox);
globalOptionsTable.RenderControl(writer);
}
示例5: RenderCheckBoxList
private void RenderCheckBoxList(HtmlTextWriter writer)
{
List<CCheckItem> listItem = new List<CCheckItem>();
foreach (CCheckItem obj in CheckItems)
{
if (obj.ItemType == ItemType.项目)
{
listItem.Add(obj);
}
}
if (listItem.Count == 0)
{
writer.Write("");
return;
}
string strItemIDs = "";
for (int i = 0; i < listItem.Count; i++)
{
if (strItemIDs != "")
{
strItemIDs += ",";
}
strItemIDs += (i + ItemIndex).ToString();
}
int rows = 0;
rows = (int)Math.Ceiling((decimal)listItem.Count / (decimal)RepeatColumns);
HtmlTable tableCheckBox = new HtmlTable();
tableCheckBox.Style.Value = "border: 0px solid white; padding: 0px; width: 100%;";
for (int i = 0; i < rows; i++)
{
HtmlTableRow row = new HtmlTableRow();
tableCheckBox.Rows.Add(row);
for (int j = 0; j < RepeatColumns; j++)
{
HtmlTableCell cell = new HtmlTableCell();
cell.Style.Value = "width: " + 100 / RepeatColumns + "%;";
row.Cells.Add(cell);
if ((i * RepeatColumns + j) < listItem.Count)
{
if (listItem[i * RepeatColumns + j].BackColor != "")
{
cell.Style.Value += " background-color: " + listItem[i * RepeatColumns + j].BackColor;
}
if (listItem[i * RepeatColumns + j].Color != "")
{
cell.Style.Value += " color: " + listItem[i * RepeatColumns + j].Color;
}
string strSingleMode = "";
if (SingleMode == SingledType.Group)
{
strSingleMode = " onclick=\"CheckBoxSingleSelect('" + this.ClientID + "', '" + strItemIDs + "', '" + ItemIndex.ToString() + "')\"";
}
else if (SingleMode == SingledType.All)
{
strSingleMode = " onclick=\"CheckBoxSingleSelect('" + this.ClientID + "', '', '" + ItemIndex.ToString() + "')\"";
}
cell.InnerHtml = "<input type=\"checkbox\" id=\"" +
this.ClientID + "_CheckBox_" + ItemIndex.ToString() + "\" selectedtext=\"" +
listItem[i * RepeatColumns + j].Text + "\" value=\"" + listItem[i * RepeatColumns + j].Value + "\"" +
strSingleMode +
" name=\"" + this.ClientID + "_CheckBoxItem" + "\"";
cell.InnerHtml += " />";
cell.InnerHtml += "<label for=\"" + this.ClientID + "_CheckBox_" + ItemIndex.ToString() + "\">" + listItem[i * RepeatColumns + j].Text + "</label>";
ItemIndex += 1;
}
}
}
tableCheckBox.RenderControl(writer);
}
示例6: GenerateReport
//.........这里部分代码省略.........
reportHtmlTable.Style.Add("font-size", "9pt");
HtmlTableRow trHeader = new HtmlTableRow();
trHeader.Style.Add("font-weight","bold");
//teamsite name
HtmlTableCell tcHeader1 = new HtmlTableCell();
tcHeader1.InnerText = "teamsite name";
trHeader.Cells.Add(tcHeader1);
//teamsite url
HtmlTableCell tcHeader2 = new HtmlTableCell();
tcHeader2.InnerText = "teamsite url";
trHeader.Cells.Add(tcHeader2);
//teamsite brand
HtmlTableCell tcHeader3 = new HtmlTableCell();
tcHeader3.InnerText = "brand";
trHeader.Cells.Add(tcHeader3);
//teamsite lastModified
HtmlTableCell tcHeader4 = new HtmlTableCell();
tcHeader4.InnerText = "last modified";
trHeader.Cells.Add(tcHeader4);
reportHtmlTable.Rows.Add(trHeader);
Console.WriteLine("Connecting to site...");
SPSite siteCollection = new SPSite(System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteUrl"]);
SPWebCollection sites = siteCollection.AllWebs;
try
{
foreach (SPWeb site in sites)
{
lastModified = "01/01/1900 01:01:01";
//go through the lists in the site for the later lastmodified date
foreach (SPList list in site.Lists)
{
if (System.DateTime.Parse(lastModified) < list.LastItemModifiedDate)
lastModified = list.LastItemModifiedDate.ToString();
}
Console.WriteLine("Site:"+site.Name+" last modified:"+lastModified);
HtmlTableRow trData = new HtmlTableRow();
//teamsite name
HtmlTableCell tcData1 = new HtmlTableCell();
tcData1.InnerText = site.Name;
trData.Cells.Add(tcData1);
//teamsite url
HtmlTableCell tcData2 = new HtmlTableCell();
HtmlAnchor ha1 = new HtmlAnchor();
ha1.InnerText=site.Url;
ha1.HRef=site.Url;
tcData2.Controls.Add(ha1);
trData.Cells.Add(tcData2);
//teamsite brand
HtmlTableCell tcData3 = new HtmlTableCell();
string brand = site.Url.ToString();
try
{
string[] ary = brand.Split('/');
tcData3.InnerText = ary[3].ToString(); // e.g. http:///blahblah fourth index will contain the brand
}
catch //the url may not contain the brand for instance the top level site
{
tcData3 .InnerText = "na";
}
trData.Cells.Add(tcData3);
//teamsite last modified date
HtmlTableCell tcData4 = new HtmlTableCell();
tcData4.InnerText = lastModified;
trData.Cells.Add(tcData4);
reportHtmlTable.Rows.Add(trData);
site.Dispose();
}
}
catch (Exception ex)
{
FileErrorLogger _logger = new FileErrorLogger();
_logger.LogError(ex.Message, ErrorLogSeverity.SeverityError,
ErrorType.TypeApplication, "TeamSiteReports.UploadFile()");
_logger = null;
}
finally
{
siteCollection.Dispose();
}
reportHtmlTable.RenderControl(txtWriter);
txtWriter.Close();
tf.UploadFile(System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteLastModifiedReportLocation"],
System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteLastModifiedReportDestination"]);
}
示例7: Render
//.........这里部分代码省略.........
//Log.Add(LogTypes.Debug, 0, "snid=>"+renderingOptions.startNodeID.ToString());
//Log.Add(LogTypes.Debug, 0, "dtid=>" + renderingOptions.allowedDocTypeIDs);
HtmlTable table = new HtmlTable();
HtmlTableRow tr;
HtmlTableCell td;
//start node
tr = new HtmlTableRow();
table.Controls.Add(tr);
td = new HtmlTableCell();
tr.Controls.Add(td);
td.InnerText = "Start Node ID";
td = new HtmlTableCell();
tr.Controls.Add(td);
TextBox startNode = new TextBox();
startNode.CssClass = "startNodeID";
td.Controls.Add(startNode);
startNode.Text = renderingOptions.startNodeID.ToString();
//allow multiple
tr = new HtmlTableRow();
table.Controls.Add(tr);
td = new HtmlTableCell();
tr.Controls.Add(td);
td.InnerText = "Allow Multiple?";
td = new HtmlTableCell();
tr.Controls.Add(td);
CheckBox allowMultiple = new CheckBox();
allowMultiple.CssClass = "allowMultiple";
td.Controls.Add(allowMultiple);
allowMultiple.Checked = renderingOptions.allowMultiple;
//allowed doctypeids
tr = new HtmlTableRow();
table.Controls.Add(tr);
td = new HtmlTableCell();
tr.Controls.Add(td);
td.InnerText = "Allowed Doc Type ID's (CSV)";
td = new HtmlTableCell();
tr.Controls.Add(td);
TextBox allowedDocTypes = new TextBox();
allowedDocTypes.CssClass = "allowedDocTypes";
td.Controls.Add(allowedDocTypes);
allowedDocTypes.Text = renderingOptions.allowedDocTypeIDs;
//show all docTypes?
tr = new HtmlTableRow();
table.Controls.Add(tr);
td = new HtmlTableCell();
tr.Controls.Add(td);
td.InnerText = "Show All Doc Types?";
td = new HtmlTableCell();
tr.Controls.Add(td);
CheckBox showAllDocTypes = new CheckBox();
showAllDocTypes.CssClass = "showAllDocTypes";
td.Controls.Add(showAllDocTypes);
showAllDocTypes.Checked = renderingOptions.showAllDocTypes;
//js path
tr = new HtmlTableRow();
table.Controls.Add(tr);
td = new HtmlTableCell();
tr.Controls.Add(td);
td.InnerText = "JS Path";
td = new HtmlTableCell();
tr.Controls.Add(td);
TextBox jsPath = new TextBox();
jsPath.CssClass = "jsPath";
td.Controls.Add(jsPath);
jsPath.Text = renderingOptions.jsPath;
//css path
tr = new HtmlTableRow();
table.Controls.Add(tr);
td = new HtmlTableCell();
tr.Controls.Add(td);
td.InnerText = "CSS Path";
td = new HtmlTableCell();
tr.Controls.Add(td);
TextBox cssPath = new TextBox();
cssPath.CssClass = "cssPath";
td.Controls.Add(cssPath);
cssPath.Text = renderingOptions.cssPath;
table.RenderControl(writer);
}
示例8: GenerateReport
//.........这里部分代码省略.........
}
trData.Cells.Add(tcData3);
//teamsite users fullname
HtmlTableCell tcData4 = new HtmlTableCell();
tcData4.InnerText = user.Name;
tcData4.BgColor = roleStyle;
trData.Cells.Add(tcData4);
//teamsite user lanId
HtmlTableCell tcData5 = new HtmlTableCell();
tcData5.InnerText = user.LoginName;
tcData5.BgColor = roleStyle;
trData.Cells.Add(tcData5);
//teamsite user email address
HtmlTableCell tcData6 = new HtmlTableCell();
HtmlAnchor haEmail = new HtmlAnchor();
haEmail.InnerText="mailto:"+user.Email;
haEmail.HRef=user.Email;
tcData6.Controls.Add(haEmail);
tcData6.InnerText = user.Email ; //email
trData.Cells.Add(tcData6);
//teamsite request for access email address
HtmlTableCell tcData8 = new HtmlTableCell();
try
{
SPPermissionCollection permsSite = site.Permissions;
if (permsSite.RequestAccess)
{
tcData8.InnerText = permsSite.RequestAccessEmail.ToString();
}
else
{
tcData8.InnerText = "";
}
}
catch //
{
tcData8.BgColor = "#FF0000";
tcData8.InnerText = "permissions error";
}
trData.Cells.Add(tcData8);
//teamsite memebrship count
HtmlTableCell tcData9 = new HtmlTableCell();
tcData9.InnerText = site.Users.Count.ToString();
trData.Cells.Add(tcData9);
//subsites
HtmlTableCell tcData10 = new HtmlTableCell();
tcData10.InnerText = subsitesCount.ToString();
if (subsitesCount>0)
tcData10.BgColor = System.Drawing.ColorTranslator.ToHtml (System.Drawing.Color.Red);
trData.Cells.Add(tcData10);
reportHtmlTable.Rows.Add(trData);
}
}
site.Dispose();
}
}
catch(Exception ex)
{
FileErrorLogger _logger = new FileErrorLogger();
_logger.LogError(ex.Message, ErrorLogSeverity.SeverityError,
ErrorType.TypeApplication, "Centrica.Intranet.TeamSiteReports.UploadFile()");
_logger = null; }
finally
{
site.Dispose();
}
}
}
catch (Exception ex)
{
FileErrorLogger _logger = new FileErrorLogger();
_logger.LogError(ex.Message, ErrorLogSeverity.SeverityError,
ErrorType.TypeApplication, "Centrica.Intranet.TeamSiteReports.UploadFile()");
_logger = null;
}
finally
{
siteCollection.Dispose();
}
reportHtmlTable.RenderControl(txtWriter);
txtWriter.Close();
tf.UploadFile(System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteOwnersReportLocation"],
System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteOwnersReportDestination"]);
Console.WriteLine("Completed");
}
示例9: SendEmails
//.........这里部分代码省略.........
where p.UserId == user.UserId &&
p.matchPredictionModify != null &&
p.matchId == m.matchId &&
m.matchDate.Year == Util.LocalDate.Now.Year &&
m.matchDate.Month == Util.LocalDate.Now.Month &&
m.matchDate.Day == Util.LocalDate.Now.Day
select p).ToList();
HtmlTableRow row = new HtmlTableRow();
GenerateColumns(row);
table.Rows.Add(row);
foreach (var prediction in predictions)
{
row = new HtmlTableRow();
HtmlTableCell cell = new HtmlTableCell();
cell.InnerText = prediction.predictionId.ToString();
row.Cells.Add(cell);
cell = new HtmlTableCell();
cell.InnerText = prediction.matchId.ToString();
row.Cells.Add(cell);
var matchInfo = (from m in ctx.Matches
where m.matchId == prediction.matchId
select m).SingleOrDefault();
cell = new HtmlTableCell();
cell.InnerText = matchInfo.stadiumName;
row.Cells.Add(cell);
cell = new HtmlTableCell();
cell.InnerText = matchInfo.matchDate.ToString("dd/MM/yyyy");
row.Cells.Add(cell);
var local = (from mt in ctx.MatchesTeam
from t in ctx.Teams
where mt.matchId == matchInfo.matchId
&& mt.teamId == t.teamId
&& mt.teamIsLocal == true
select t).SingleOrDefault();
cell = new HtmlTableCell();
cell.InnerText = local.teamName;
row.Cells.Add(cell);
cell = new HtmlTableCell();
cell.InnerText = prediction.homeResult.ToString();
row.Cells.Add(cell);
cell = new HtmlTableCell();
cell.InnerText = prediction.homePenaltyResult.ToString();
row.Cells.Add(cell);
var visitor = (from mt in ctx.MatchesTeam
from t in ctx.Teams
where mt.matchId == matchInfo.matchId
&& mt.teamId == t.teamId
&& mt.teamIsLocal == false
select t).SingleOrDefault();
cell = new HtmlTableCell();
cell.InnerText = visitor.teamName;
row.Cells.Add(cell);
cell = new HtmlTableCell();
cell.InnerText = prediction.awayResult.ToString();
row.Cells.Add(cell);
cell = new HtmlTableCell();
cell.InnerText = prediction.awayPenaltyResult.ToString();
row.Cells.Add(cell);
cell = new HtmlTableCell();
cell.InnerText = prediction.matchPredictionModify.ToString();
row.Cells.Add(cell);
table.Rows.Add(row);
}
StringBuilder sb = new StringBuilder();
StringWriter tw = new StringWriter(sb);
HtmlTextWriter hw = new HtmlTextWriter(tw);
table.RenderControl(hw);
builder.Append(sb.ToString());
builder.Append("<br>");
}
mailMsg.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(builder.ToString(), null, MediaTypeNames.Text.Html));
mailMsg.IsBodyHtml = true;
mailMsg.From = new MailAddress("[email protected]");
//mailMsg.To.Add(new MailAddress(user.emailAddress));
mailMsg.Subject = "Predicciones hechas por los usuarios para el Mundial 2014";
SmtpClient smtpClient = null;
smtpClient = new SmtpClient();
//smtpClient.Send(new MailMessage("[email protected]", user.emailAddress, "Predicciones hechas por los usuarios para el Mundial 2014", string.Empty));
smtpClient.Send(mailMsg);
return RedirectToAction("Index", "Home");
}
示例10: Render
protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
HtmlTable table = new HtmlTable();
table.Border = 0;
table.CellPadding = 0;
table.CellSpacing = 1;
table.Width = "100%";
table.ID = ClientID;
for (int nQuarter = 0; nQuarter < 4; nQuarter++)
{
HtmlTableRow tr = new HtmlTableRow();
table.Rows.Add(tr);
for (int nQMonth = 1; nQMonth <= 3; nQMonth++)
{
HtmlTableCell td = new HtmlTableCell();
tr.Cells.Add(td);
td.VAlign = "top";
td.Align = "center";
td.Attributes.Add("class", "control-calendar-body-month");
DateTime dtCurrentMonth = new DateTime(WatchYear, 3 * nQuarter + nQMonth, 1);
Label lblMonth = new Label();
td.Controls.Add(lblMonth);
lblMonth.CssClass = "control-calendar-label";
lblMonth.Text = dtCurrentMonth.ToString("MMMM");
Calendar cal = new Calendar();
cal.ID = ClientID;
td.Controls.Add(cal);
cal.ToolTip = lblMonth.Text;
cal.FirstDayOfWeek = FirstDayOfWeek.Monday;
cal.VisibleDate = new DateTime(WatchYear, 3 * nQuarter + nQMonth, 1);
cal.Width = new Unit(100, UnitType.Percentage);
cal.CssClass = "control-calendar-month-box";
cal.ShowGridLines = true;
cal.ShowTitle = false;
cal.ShowNextPrevMonth = false;
cal.SelectionMode = CalendarSelectionMode.None;
cal.DayHeaderStyle.CssClass = "control-calendar-month-body-day-header";
cal.DayStyle.CssClass = "control-calendar-month-body-weekday";
cal.WeekendDayStyle.CssClass = "control-calendar-month-body-weekend";
cal.OtherMonthDayStyle.CssClass = "control-calendar-month-body-weekday";
cal.OtherMonthDayStyle.ForeColor = System.Drawing.Color.FromArgb(0xfa, 0xfa, 0xfa);//"#fafafa";
cal.DayRender += new DayRenderEventHandler(YearCalendar_RenderDay);
}
}
table.RenderControl(writer);
}
示例11: GenerateReport
//.........这里部分代码省略.........
trHeader.Cells.Add(tcHeader1);
//teamsite url
HtmlTableCell tcHeader2 = new HtmlTableCell();
tcHeader2.InnerText = "teamsite url";
trHeader.Cells.Add(tcHeader2);
//teamsite # docs
HtmlTableCell tcHeader3 = new HtmlTableCell();
tcHeader3.InnerText = "#docs";
trHeader.Cells.Add(tcHeader3);
//teamsite size Mbytes
HtmlTableCell tcHeader4 = new HtmlTableCell();
tcHeader4.InnerText = "filesize (MB)";
trHeader.Cells.Add(tcHeader4);
reportHtmlTable.Rows.Add(trHeader);
Console.WriteLine("Connecting to site...");
SPSite siteCollection = new SPSite(System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteUrl"]);
SPWebCollection sites = siteCollection.AllWebs;
try
{
foreach (SPWeb site in sites)
{
try
{
totalFileSize = 0;
fileCount = 0;
SPFolderCollection folders = site.Folders;
traverseFolders(folders);
Console.WriteLine( "Summary: " + SPEncode.HtmlEncode(site.Name) + " Number: " + fileCount +
" Size: " + totalFileSize);
HtmlTableRow trData = new HtmlTableRow();
//teamsite name
HtmlTableCell tcData1 = new HtmlTableCell();
tcData1.InnerText = site.Name;
trData.Cells.Add(tcData1);
//teamsite url
HtmlTableCell tcData2 = new HtmlTableCell();
HtmlAnchor ha1 = new HtmlAnchor();
ha1.InnerText=site.Url;
ha1.HRef=site.Url;
tcData2.Controls.Add(ha1);
trData.Cells.Add(tcData2);
//teamsite # docs
HtmlTableCell tcData3 = new HtmlTableCell();
tcData3 .InnerText = fileCount.ToString();
trData.Cells.Add(tcData3);
//teamsite size Mbytes
HtmlTableCell tcData4 = new HtmlTableCell();
totalFileSize = totalFileSize / 1000000;
tcData4.InnerText = totalFileSize.ToString();
//tcData4.BgColor = roleStyle;
trData.Cells.Add(tcData4);
reportHtmlTable.Rows.Add(trData);
}
catch(Exception ex)
{
FileErrorLogger _logger = new FileErrorLogger();
_logger.LogError(ex.Message, ErrorLogSeverity.SeverityError,
ErrorType.TypeApplication, "Intranet.TeamSiteReports.UploadFile()");
_logger = null;
}
finally
{
site.Dispose();
}
}
}
catch (Exception ex)
{
FileErrorLogger _logger = new FileErrorLogger();
_logger.LogError(ex.Message, ErrorLogSeverity.SeverityError,
ErrorType.TypeApplication, "Intranet.TeamSiteReports.UploadFile()");
_logger = null;
}
finally
{
siteCollection.Dispose();
}
reportHtmlTable.RenderControl(txtWriter);
txtWriter.Close();
tf.UploadFile(System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteSizeReportLocation"],
System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteSizeReportDestination"]);
}
示例12: PrintResults
//.........这里部分代码省略.........
if (result.TestStatus == Enums.TestStatus.Failed)
{
if (result.ErrorMessage.Equals("Failed to execute tests due to insufficient GACS access."))
{
cell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:9pt;font-weight:bold;";
cell.InnerText = result.ErrorMessage;
}
else
{
cell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:9pt;font-weight:bold;color:#FFFFFF;vertical-align:middle;position:relative;";
cell.InnerHtml = "<a href =" + result.ImagePath + "> " + result.ErrorMessage + "</a> " + @"<div style=""background:#ac2925; width: 20px; height:20px; border-radius:50%;display:inline-block;position:absolute;bottom:10%""></div>";
}
}
else if (result.TestStatus == Enums.TestStatus.Completed)
{
cell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-weight:bold;color:#FFFFFF;font-family:Verdana;font-size:9pt; vertical-align:middle;position:relative;";
cell.InnerHtml = "<a href =" + testParameters.First().ImagePath.ToString() + "> " + result.TestStatus.ToString() + "</a> " + @"<div style=""background:#397439; width: 20px; height:20px; border-radius:50%;display:inline-block;position:absolute;bottom:10%""></div>";
}
testparamets.Cells.Add(cell);
table.Rows.Add(testparamets);
this.testParameterRowCount++;
if (result.CurrentData != null)
{
HtmlTableRow testDataRow = new HtmlTableRow();
testDataRow.ID = this.testParameterRowCount.ToString();
testDataRow.Style.Add(HtmlTextWriterStyle.Display, "none");
testDataRow.Style.Add(HtmlTextWriterStyle.Width, "100%");
HtmlTableCell testDataCell = new HtmlTableCell();
testDataCell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;";
testDataCell.ColSpan = 4;
testDataCell.Width = "100%";
HtmlTable testDataTable = new HtmlTable();
testDataTable.Width = "100%";
testDataTable.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;";
foreach (TestAutomationTemplate.Core.TestResult.TestData td in result.CurrentData)
{
HtmlTableRow testDataTableRow = new HtmlTableRow();
testDataTableRow.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;";
if (x % 2 == 0)
{
testDataTable.BgColor = "#FFFFFF";
}
else
{
testDataTable.BgColor = "#F0F0F0";
}
HtmlTableCell testDataTableCell = new HtmlTableCell();
testDataTableCell.InnerHtml = "<li><b>" + td.Name + "</b>: " + td.Value + "</li>";
testDataTableCell.ColSpan = 4;
testDataTableCell.Width = "100%";
testDataTableCell.Attributes.CssStyle.Value = "border-bottom:None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:8pt;padding:5px 5px 5px 5px;text-indent:50px;";
testDataTableRow.Cells.Add(testDataTableCell);
testDataTable.Rows.Add(testDataTableRow);
}
StringBuilder innerTable = new StringBuilder();
testDataTable.RenderControl(new HtmlTextWriter(new StringWriter(innerTable)));
testDataCell.InnerHtml = innerTable.ToString();
testDataRow.Cells.Add(testDataCell);
table.Rows.Add(testDataRow);
this.testParameterRowCount++;
}
else
{
HtmlTableRow testDataRow = new HtmlTableRow();
testDataRow.ID = this.testParameterRowCount.ToString();
testDataRow.Style.Add(HtmlTextWriterStyle.Display, "none");
testDataRow.Style.Add(HtmlTextWriterStyle.Width, "100%");
HtmlTableCell testDataCell = new HtmlTableCell();
testDataCell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-family:Verdana; font-size:8pt;";
testDataCell.ColSpan = 4;
testDataCell.Width = "100%";
testDataCell.InnerHtml = "<b>Test Parameters not available</b>";
testDataRow.Cells.Add(testDataCell);
table.Rows.Add(testDataRow);
this.testParameterRowCount++;
}
}
}
}
}
StringBuilder stringBuilder = new StringBuilder();
table.RenderControl(new HtmlTextWriter(new StringWriter(stringBuilder)));
this.emailBody = this._reportJavaScript.WriteHTMLHeaderInformation().ToString() + this.PrintOverallStats().ToString() + stringBuilder.ToString() + this._reportJavaScript.GenerateJavaScriptCode(this.testDataRowCount).ToString();
string reportDirectory = CustomConfiguration.TempDirectory;
File.WriteAllText(reportDirectory + "Results.html", this.emailBody);
this.CopyImagestoReportFolder(reportDirectory);
stringBuilder.Clear();
table.Dispose();
return this.emailBody.ToString();
}
示例13: NoResults
/// <summary>
/// Noes the results.
/// </summary>
/// <returns></returns>
private string NoResults()
{
HtmlTable NoResultsTable = new HtmlTable();
NoResultsTable.EnableTheming = true;
NoResultsTable.Border = 1;
NoResultsTable.BorderColor = "#000000";
NoResultsTable.Width = "100%";
NoResultsTable.CellSpacing = 0;
HtmlTableRow NoResultsTableName = new HtmlTableRow();
HtmlTableCell NoResultsTableNameCell = new HtmlTableCell("th");
NoResultsTableNameCell.ColSpan = 4;
NoResultsTableName.BorderColor = "#FFFFFF";
NoResultsTableNameCell.Attributes.CssStyle.Value = "border-bottom: None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:9pt;color:#FFFFFF;";
NoResultsTableNameCell.BgColor = "#808080";
NoResultsTableNameCell.Align = "left";
NoResultsTableNameCell.InnerText = "No test results available";
NoResultsTableName.BgColor = "#808080";
NoResultsTableName.Cells.Add(NoResultsTableNameCell);
NoResultsTable.Rows.Add(NoResultsTableName);
StringBuilder NoResultsStringBuilder = new StringBuilder();
NoResultsTable.RenderControl(new HtmlTextWriter(new StringWriter(NoResultsStringBuilder)));
this.emailBody = NoResultsStringBuilder.ToString();
NoResultsStringBuilder.Clear();
NoResultsTable.Dispose();
return this.emailBody.ToString();
}
示例14: PrintOverallStats
//.........这里部分代码省略.........
HtmlTableRow tableHeadings = new HtmlTableRow();
HtmlTableCell headingCell;
tableHeadings = new HtmlTableRow();
headingCell = new HtmlTableCell();
tableHeadings.BgColor = "#FFFFFF";
headingCell.InnerHtml = "<br>";
headingCell.Attributes.CssStyle.Value = "border-bottom: None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:5pt;font-weight:bold;padding:5px 5px 5px 5px;color:#FFFFFF;";
tableHeadings.Cells.Add(headingCell);
table.Rows.Add(tableHeadings);
tableHeadings = new HtmlTableRow();
headingCell = new HtmlTableCell();
headingCell.InnerHtml = @"<span style=""color:#666""><b> Browser: </b></span>" + BaseClass.GetBrowserNameAndVersion();
tableHeadings.BgColor = "#FFFFFF";
headingCell.ColSpan = 1;
headingCell.Attributes.CssStyle.Value = "border-bottom:None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:10pt;padding:5px 5px 5px 5px;";
tableHeadings.Cells.Add(headingCell);
table.Rows.Add(tableHeadings);
tableHeadings = new HtmlTableRow();
headingCell = new HtmlTableCell();
headingCell.InnerHtml = @"<span style=""color:#666""><b>No. of Test(s): </b></span>" + this.NoTests();
tableHeadings.BgColor = "#FFFFFF";
headingCell.ColSpan = 1;
headingCell.Attributes.CssStyle.Value = "border-bottom:None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:10pt;padding:5px 5px 5px 5px;";
tableHeadings.Cells.Add(headingCell);
table.Rows.Add(tableHeadings);
tableHeadings = new HtmlTableRow();
headingCell = new HtmlTableCell();
if (this.NoTestsCompleted() == 0)
{
headingCell.BgColor = "#FFFFFF";
headingCell.InnerHtml = @"<b><span style=""color:#666""> No. of Passed Test(s)</span></b>: None";
headingCell.Attributes.CssStyle.Value = "border-bottom: None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:10pt;padding:5px 5px 5px 5px;position:relative;";
}
else
{
headingCell.InnerHtml = @"<span style=""color:#666""><b>No. of Passed Test(s): </b></span>" + this.NoTestsCompleted().ToString() + " of " + this.NoTests().ToString() + " " + @"<div style=""background:#397439; width: 20px; height:20px; border-radius:50%;display:inline-block;position:absolute;bottom:10%""></div>";
headingCell.Attributes.CssStyle.Value = "border-bottom: None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:10pt;padding:5px 5px 5px 5px;position:relative;";
}
tableHeadings.Cells.Add(headingCell);
table.Rows.Add(tableHeadings);
tableHeadings = new HtmlTableRow();
headingCell = new HtmlTableCell();
if (this.NoTestsFailed() == 0)
{
headingCell.BgColor = "#FFFFFF";
headingCell.InnerHtml = @"<span style=""color:#666""><b>No. of Failed Test(s):</b></span> None";
headingCell.Attributes.CssStyle.Value = "border-bottom: None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:10pt;padding:5px 5px 5px 5px;position:relative;";
}
else
{
headingCell.InnerHtml = @"<span style=""color:#666""><b>No. of Failed Test(s): </b></span>" + this.NoTestsFailed().ToString() + " of " + this.NoTests().ToString() + " " + @"<div style=""background:#ac2925; width: 20px; height:20px; border-radius:50%;display:inline-block;position:absolute;bottom:10%""></div>";
headingCell.Attributes.CssStyle.Value = "border-bottom: None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:10pt;padding:5px 5px 5px 5px;position:relative;";
}
tableHeadings.Cells.Add(headingCell);
table.Rows.Add(tableHeadings);
tableHeadings = new HtmlTableRow();
headingCell = new HtmlTableCell();
tableHeadings.BgColor = "#FFFFFF";
headingCell.InnerHtml = @"<span style=""color:#666""><b>Total Time: </b></span>" + this.GetTotalTime(timeStop, timeStart);
headingCell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:10pt;padding:5px 5px 5px 5px;";
tableHeadings.Cells.Add(headingCell);
table.Rows.Add(tableHeadings);
if (CustomConfiguration.RecordVideo)
{
tableHeadings = new HtmlTableRow();
headingCell = new HtmlTableCell();
tableHeadings.BgColor = "#FFFFFF";
headingCell.InnerHtml = @"<span style=""color:#666""><b>Full Test Run: </b></span><a href =""TestReportVideo.mp4"">Video</a> (To View Video Right-Click Save As)";
headingCell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:10pt;padding:5px 5px 5px 5px;";
tableHeadings.Cells.Add(headingCell);
table.Rows.Add(tableHeadings);
}
tableHeadings = new HtmlTableRow();
headingCell = new HtmlTableCell();
tableHeadings.BgColor = "#FFFFFF";
headingCell.InnerHtml = "<br>";
headingCell.Attributes.CssStyle.Value = "border-bottom: None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:3pt;padding:5px 5px 5px 5px;color:#FFFFFF;";
tableHeadings.Cells.Add(headingCell);
table.Rows.Add(tableHeadings);
StringBuilder stringBuilder = new StringBuilder();
table.RenderControl(new HtmlTextWriter(new StringWriter(stringBuilder)));
StringBuilder stats = new StringBuilder();
stats = stringBuilder;
return stats;
}
示例15: WriteToHtml
private static MvcHtmlString WriteToHtml(HtmlTable table)
{
var sw = new StringWriter(new StringBuilder());
var htw = new HtmlTextWriter(sw);
table.RenderControl(htw);
return new MvcHtmlString(sw.ToString());
}