当前位置: 首页>>代码示例>>C#>>正文


C# HtmlTextWriter.EndDocument方法代码示例

本文整理汇总了C#中System.Web.UI.HtmlTextWriter.EndDocument方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTextWriter.EndDocument方法的具体用法?C# HtmlTextWriter.EndDocument怎么用?C# HtmlTextWriter.EndDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.HtmlTextWriter的用法示例。


在下文中一共展示了HtmlTextWriter.EndDocument方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateHtmlReport


//.........这里部分代码省略.........

                    writer.RenderElement(HtmlTextWriterTag.Td, asset.FriendlyName);
                    writer.RenderElement(HtmlTextWriterTag.Td, asset.TypeId);
                    writer.RenderElement(HtmlTextWriterTag.Td, asset.SubtypeId);
                    writer.RenderElement(HtmlTextWriterTag.Td, new EnumToResouceConverter().Convert(asset.Accessible, typeof(string), null, CultureInfo.CurrentUICulture));
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "right");
                    writer.RenderElement(HtmlTextWriterTag.Td, "{0:#,##0.00}", asset.Mass);
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "right");
                    writer.RenderElement(HtmlTextWriterTag.Td, "{0:#,##0.00}", asset.Volume);
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "right");
                    writer.RenderElement(HtmlTextWriterTag.Td, "{0:hh\\:mm\\:ss\\.ff}", asset.Time);

                    writer.RenderEndTag(); // Tr
                }
                writer.RenderEndTag(); // Table 

                #endregion

                #region Items

                writer.RenderElement(HtmlTextWriterTag.H1, "Items");
                writer.BeginTable("1", "3", "0",
                    new[] { "Icon", "Name", "Type Id", "Sub Type Id", "Accessible", "Mass (Kg)", "Volume (L)", "Build Time (h:m:s)" });

                foreach (var asset in ItemAssets)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);

                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    if (asset.TextureFile != null && File.Exists(asset.TextureFile))
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Src, "data:image/png;base64," + ImageTextureUtil.GetTextureToBase64(asset.TextureFile, 32, 32));
                        writer.AddAttribute(HtmlTextWriterAttribute.Width, "32");
                        writer.AddAttribute(HtmlTextWriterAttribute.Height, "32");
                        writer.AddAttribute(HtmlTextWriterAttribute.Alt, Path.GetFileNameWithoutExtension(asset.TextureFile));
                        writer.RenderBeginTag(HtmlTextWriterTag.Img);
                        writer.RenderEndTag();
                    }
                    writer.RenderEndTag(); // Td

                    writer.RenderElement(HtmlTextWriterTag.Td, asset.FriendlyName);
                    writer.RenderElement(HtmlTextWriterTag.Td, asset.TypeId);
                    writer.RenderElement(HtmlTextWriterTag.Td, asset.SubtypeId);
                    writer.RenderElement(HtmlTextWriterTag.Td, new EnumToResouceConverter().Convert(asset.Accessible, typeof(string), null, CultureInfo.CurrentUICulture));
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "right");
                    writer.RenderElement(HtmlTextWriterTag.Td, "{0:#,##0.00}", asset.Mass);
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "right");
                    writer.RenderElement(HtmlTextWriterTag.Td, "{0:#,##0.00}", asset.Volume);
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "right");
                    writer.RenderElement(HtmlTextWriterTag.Td, "{0:hh\\:mm\\:ss\\.ff}", asset.Time);

                    writer.RenderEndTag(); // Tr
                }
                writer.RenderEndTag(); // Table 

                #endregion

                #region Materials

                writer.RenderElement(HtmlTextWriterTag.H1, "Materials");
                writer.BeginTable("1", "3", "0",
                    new[] { "Texture", "Name", "Ore Name", "Rare", "Mined Ore Ratio" });

                foreach (var asset in MaterialAssets)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);

                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    if (asset.TextureFile != null && File.Exists(asset.TextureFile))
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Src, "data:image/png;base64," + ImageTextureUtil.GetTextureToBase64(asset.TextureFile, 32, 32, true));
                        writer.AddAttribute(HtmlTextWriterAttribute.Width, "32");
                        writer.AddAttribute(HtmlTextWriterAttribute.Height, "32");
                        writer.AddAttribute(HtmlTextWriterAttribute.Alt, Path.GetFileNameWithoutExtension(asset.TextureFile));
                        writer.RenderBeginTag(HtmlTextWriterTag.Img);
                        writer.RenderEndTag();
                    }
                    writer.RenderEndTag(); // Td

                    writer.RenderElement(HtmlTextWriterTag.Td, asset.Name);
                    writer.RenderElement(HtmlTextWriterTag.Td, asset.OreName);
                    writer.RenderElement(HtmlTextWriterTag.Td, new EnumToResouceConverter().Convert(asset.IsRare, typeof(string), null, CultureInfo.CurrentUICulture));
                    writer.RenderElement(HtmlTextWriterTag.Td, "{0:#,##0.00}", asset.MineOreRatio);

                    writer.RenderEndTag(); // Tr
                }
                writer.RenderEndTag(); // Table 

                #endregion

                #region footer

                writer.EndDocument();

                #endregion
            }

            // Write to disk.
            File.WriteAllText(filename, stringWriter.ToString());
        }
开发者ID:midspace,项目名称:SEToolbox,代码行数:101,代码来源:ComponentListModel.cs

示例2: CreateHtmlReport


//.........这里部分代码省略.........
                    writer.RenderElement(HtmlTextWriterTag.Td, "{0:#,##0.000}", item.Mass);
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "right");
                    writer.RenderElement(HtmlTextWriterTag.Td, "{0:#,##0.000}", item.Volume);
                    writer.RenderElement(HtmlTextWriterTag.Td, "{0}", item.Time);
                    writer.RenderEndTag(); // Tr
                }
                writer.EndTable();

                writer.RenderElement(HtmlTextWriterTag.H3, "All Items");
                writer.BeginTable("1", "3", "0", new[] { "Icon", "Name", "Count", "Mass Kg", "Volume L", "Time" });
                foreach (var item in _allItems)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    if (item.TextureFile != null && File.Exists(item.TextureFile))
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Src, "data:image/png;base64," + ImageTextureUtil.GetTextureToBase64(item.TextureFile, 32, 32));
                        writer.AddAttribute(HtmlTextWriterAttribute.Width, "32");
                        writer.AddAttribute(HtmlTextWriterAttribute.Height, "32");
                        writer.AddAttribute(HtmlTextWriterAttribute.Alt, Path.GetFileNameWithoutExtension(item.TextureFile));
                        writer.RenderBeginTag(HtmlTextWriterTag.Img);
                        writer.RenderEndTag();
                    }
                    writer.RenderEndTag(); // Td

                    writer.RenderElement(HtmlTextWriterTag.Td, item.FriendlyName);
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "right");
                    writer.RenderElement(HtmlTextWriterTag.Td, "{0:#,##0}", item.Count);
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "right");
                    writer.RenderElement(HtmlTextWriterTag.Td, "{0:#,##0.000}", item.Mass);
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "right");
                    writer.RenderElement(HtmlTextWriterTag.Td, "{0:#,##0.000}", item.Volume);
                    writer.RenderElement(HtmlTextWriterTag.Td, "{0}", item.Time);
                    writer.RenderEndTag(); // Tr
                }
                writer.EndTable();

                #endregion

                writer.RenderElement(HtmlTextWriterTag.Br);
                writer.RenderElement(HtmlTextWriterTag.Hr);

                writer.RenderElement(HtmlTextWriterTag.H2, "Resources breakdown");

                #region Asteroid breakdown

                writer.RenderElement(HtmlTextWriterTag.H3, "Untouched Ores (Asteroids)");
                writer.BeginTable("1", "3", "0", new[] { "Asteroid", "Position", "Ore name", "Volume m³" });
                foreach (var asteroid in _untouchedOreByAsteroid)
                {
                    var inx = 0;
                    foreach (var item in asteroid.UntouchedOreList)
                    {
                        writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                        if (inx == 0)
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, asteroid.UntouchedOreList.Count.ToString(CultureInfo.InvariantCulture));
                            writer.RenderElement(HtmlTextWriterTag.Td, asteroid.Name);

                            writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, asteroid.UntouchedOreList.Count.ToString(CultureInfo.InvariantCulture));
                            writer.RenderElement(HtmlTextWriterTag.Td, "{0},{1},{2}", asteroid.Position.X, asteroid.Position.Y, asteroid.Position.Z);
                        }
                        writer.RenderElement(HtmlTextWriterTag.Td, item.MaterialName);
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, "right");
                        writer.RenderElement(HtmlTextWriterTag.Td, "{0:#,##0.000}", item.Volume);
                        writer.RenderEndTag(); // Tr
                        inx++;
                    }
                }
                writer.EndTable();

                #endregion

                writer.RenderElement(HtmlTextWriterTag.Br);
                writer.RenderElement(HtmlTextWriterTag.Hr);

                #region Ship breakdown

                writer.BeginTable("1", "3", "0", new[] { "Ship", "EntityId", "Position", "Block Count" });
                foreach (var ship in _allShips)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                    writer.RenderElement(HtmlTextWriterTag.Td, ship.DisplayName);
                    writer.RenderElement(HtmlTextWriterTag.Td, ship.EntityId);
                    writer.RenderElement(HtmlTextWriterTag.Td, "{0},{1},{2}", ship.Position.X, ship.Position.Y, ship.Position.Z);
                    writer.RenderElement(HtmlTextWriterTag.Td, ship.BlockCount);

                    // TODO: more detail.

                    writer.RenderEndTag(); // Tr
                }
                writer.EndTable();

                #endregion

                writer.EndDocument();
            }

            return stringWriter.ToString();
        }
开发者ID:Tygra,项目名称:SEToolbox,代码行数:101,代码来源:ResourceReportModel.cs


注:本文中的System.Web.UI.HtmlTextWriter.EndDocument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。