Esempio n. 1
0
        private static void TestXlsx()
        {
            string        filePath = "test.xlsx";
            Xlsx          xlsx     = Xlsx.Create(filePath);
            StringBuilder sb       = new StringBuilder();

            xlsx.ExportCSharp(sb);
            File.WriteAllText(string.Format("GameData/{0}.cs", xlsx.FileName), sb.ToString());

            Properties      prop = Properties.CreateFromXlsx(xlsx);
            SecurityElement root = Properties.ConvertPropertiesToXML(prop);
            // 格式化
            XElement element = XElement.Parse(root.ToString());

            File.WriteAllText("xlsx_2_properties_2_xml.xml", element.ToString());
        }
        private static bool ExportXlsxFile(string filePath)
        {
            Xlsx xlsx = Xlsx.Create(filePath);

            if (xlsx != null)
            {
                xlsx.InitializeRecord();
                bool res = ExportCS(xlsx);
                res &= ExportXml(xlsx);
                return(res);
            }
            else
            {
                MainEntry.Log(string.Format("ExportXlsxFile Wrong: {0}", filePath));
                return(false);
            }
        }