OTFontFileVal.Driver.OpenXmlReportFile C# (CSharp) 메소드

OpenXmlReportFile() 공개 메소드

public OpenXmlReportFile ( string sReportFile, string sFontFile ) : void
sReportFile string
sFontFile string
리턴 void
        public void OpenXmlReportFile(string sReportFile, string sFontFile)
        {
            Stream stream;

            try
            {
                stream = new FileStream(sReportFile, FileMode.Create, FileAccess.ReadWrite, FileShare.None);
            }
            catch (IOException)
            {
                // This error needs to abort for the command line
                // driver, since we are not viewing afterwards.
                Console.WriteLine("Could not open the report file. Not outputting report");
                stream = new MemoryStream(); //Just dumping into memory, later this is thrown away
            }

            m_xmlWriter = new XmlTextWriter(stream,
                                                Encoding.UTF8);
            m_xmlWriter.WriteStartDocument();
            m_xmlWriter.WriteWhitespace("\r\n");
            string type = "type=\"text/xsl\" href=\"fval.xsl\"";
            m_xmlWriter.WriteProcessingInstruction("xml-stylesheet", type );
            m_xmlWriter.WriteWhitespace("\r\n");
            m_xmlWriter.WriteStartElement("FontValidatorReport");
            string dateAndTime = System.DateTime.Now.ToString("f", null);
            m_xmlWriter.WriteAttributeString("RunDateTime", dateAndTime );
            #if !OLD_INTERFACE
            m_xmlWriter.WriteAttributeString("MachineName",
                                             SystemInformation.ComputerName);
            #endif
            m_xmlWriter.WriteWhitespace("\r\n");

            FileInfo fi = new FileInfo(sFontFile);

            m_xmlWriter.WriteStartElement("FontFile");
            m_xmlWriter.WriteAttributeString("FileName", fi.Name);
            m_xmlWriter.WriteAttributeString("FileNameAndPath", sFontFile);
            m_xmlWriter.WriteWhitespace("\r\n");
        }