如何使用xmlmaps.importXml(string,object)保持前导零

时间:2019-07-01 13:43:03

标签: javascript activexobject

我正在使用ActiveXobject(“ Excel应用程序”)。而使用xmlmaps.importXml(string,object)前导零导出到excel时将被删除。但我的xmldata包含前导零的数据

enter code here


if (oViewList && oViewList.childNodes && oViewList.childNodes.length > 0)
                    {
                        ++hdnColCount;
                        hdnSheet.Range(hdnSheet.Cells(1, hdnColCount).Address).EntireColumn.XPath.SetValue(oWB.XmlMaps(1), xpathlist);

                        oXL.DisplayAlerts = false;
                        oWB.XmlMaps(1).ImportXml(XMLToString(objControlXml.xml),true); 
                        oXL.DisplayAlerts = true;
                        rangeAddress = hdnSheet.Range(hdnSheet.Cells(2,hdnColCount),hdnSheet.Cells(oViewList.childNodes.length+1,hdnColCount)).Address;
                        var nRange = "Range" + hdnColCount;
                        hdnSheet.Range(rangeAddress).Name = nRange;
                        oList.ListColumns(i+1).Range(1).EntireColumn.Validation.Add(3, 1, 1, "=" + nRange);
                        oList.ListColumns(i+1).Range(1).EntireColumn.Validation.InCellDropdown = true;
                    }

0 个答案:

没有答案