Beispiel #1
0
        /// <summary>
        /// Excel转Json操作
        /// </summary>
        private void ExcelToXmls()
        {
            ExcelUtilities excelUtilities = new ExcelUtilities();
            var            data           = excelUtilities.ExcelToDataTable(文件路径.Text);

            if (data != null && data.Rows.Count > 0)
            {
                XmlUtilities xmlUtilities = new XmlUtilities();
                string       xml          = xmlUtilities.ConvertDataTableToXML(data);
                if (xmlUtilities.SaveXml(xml, 文件夹路径.Text))
                {
                    MessageCommon.ShowInf("转换成功");
                }
                else
                {
                    MessageCommon.ShowErr("转换失败");
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Excel转Json操作
        /// </summary>
        private void ExcelToJsons()
        {
            ExcelUtilities excelUtilities = new ExcelUtilities();
            var            data           = excelUtilities.ExcelToDataTable(文件路径.Text);

            if (data != null && data.Rows.Count > 0)
            {
                JsonUtilities jsonUtilities = new JsonUtilities();
                jsonUtilities.SaveJson(data, 文件夹路径.Text);
                if (jsonUtilities.SaveJson(data, 文件夹路径.Text))
                {
                    MessageCommon.ShowInf("转换成功");
                }
                else
                {
                    MessageCommon.ShowErr("转换失败");
                }
            }
        }