| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2081 人关注过本帖
标题:请问vfp操作excel表替换问题
只看楼主 加入收藏
cnsgh
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2015-3-30
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:11 
请问vfp操作excel表替换问题
eole.Cells.REPLACE("0","")

目前我知道可以这样用,不过这是部分匹配,这会替换掉所有的0的
我需要单元格匹配的替换就是全部匹配,
vba宏中有个lookat:=xlWhole 是控制 全部匹配的

不知道怎么用在VFP上,请求支援,谢谢!
搜索更多相关主题的帖子: excel 
2015-05-12 20:23
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25859
专家分:48889
注 册:2011-6-22
收藏
得分:5 
用vfp操纵Excel,是互补,即vfp做Excel所不能做的,Excel做vfp所不能做的。如果你的需求,用Excel能够更好地完成,就直接用Excel的宏写好一段处理代码,在vfp操纵时调用这个宏即可,無需全部用vfp代码写成。在Excel文档中把宏写好,存储为带宏的文档,打开时也必须容许启用宏。

授人以渔,不授人以鱼。
2015-05-12 20:40
cnsgh
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2015-3-30
收藏
得分:0 
我是想把导出的excel表直接再vfp中处理成可直接打印的样式,所以有这需求,呵呵
按格式应该是eole.Cells.REPLACE("0","",xlwhole)这样
 xlWhole不能直接用上,折腾了好久没解决,刚发现这里是需要用Excel常量单元的
  xlWhole 的常量单元式 1
也就是说eole.Cells.REPLACE("0","",1) 就解决了 单元格匹配问题了。

(自己解决了,帖子怎么处理来着??)
下面是搜到的Delphi Excel常量单元 好像是通用的,在这里记录下
xlBetween = 1;   
  xlEqual = 3;   
  xlGreater = 5;   
  xlGreaterEqual = 7;   
  xlLess = 6;   
  xlLessEqual = 8;   
  xlNotBetween = 2;   
  xlNotEqual = 4;   
  xlCellValue = 1;   
  xlExpression = 2;   
  xlButtonControl = 0;   
  xlCheckBox = 1;   
  xlDropDown = 2;   
  xlEditBox = 3;   
  xlGroupBox = 4;   
  xlLabel = 5;   
  xlListBox = 6;   
  xlOptionButton = 7;   
  xlScrollBar = 8;   
  xlSpinner = 9;   
  xlColumnLabels = 2;   
  xlMixedLabels = 3;   
  xlNoLabels = -4142;   
  xlRowLabels = 1;   
  xlHAlignCenter = -4108;   
  xlHAlignCenterAcrossSelection = 7;   
  xlHAlignDistributed = -4117;   
  xlHAlignFill = 5;   
  xlHAlignGeneral = 1;   
  xlHAlignJustify = -4130;   
  xlHAlignLeft = -4131;   
  xlHAlignRight = -4152;   
  xlHebrewFullScript = 0;   
  xlHebrewMixedAuthorizedScript = 3;   
  xlHebrewMixedScript = 2;   
  xlHebrewPartialScript = 1;   
  xlAllChanges = 2;   
  xlNotYetReviewed = 3;   
  xlSinceMyLastSave = 1;   
  xlHtmlCalc = 1;   
  xlHtmlChart = 3;   
  xlHtmlList = 2;   
  xlHtmlStatic = 0;   
  xlIMEModeAlpha = 8;   
  xlIMEModeAlphaFull = 7;   
  xlIMEModeDisable = 3;   
  xlIMEModeHangul = 10;   
  xlIMEModeHangulFull = 9;   
  xlIMEModeHiragana = 4;   
  xlIMEModeKatakana = 5;   
  xlIMEModeKatakanaHalf = 6;   
  xlIMEModeNoControl = 0;   
  xlIMEModeOff = 2;   
  xlIMEModeOn = 1;   
  xlPivotTableReport = 1;   
  xlQueryTable = 0;   
  xlFormatFromLeftOrAbove = 0;   
  xlFormatFromRightOrBelow = 1;   
  xlShiftDown = -4121;   
  xlShiftToRight = -4161;   
  xlOutline = 1;   
  xlTabular = 0;   
  xlLegendPositionBottom = -4107;   
  xlLegendPositionCorner = 2;   
  xlLegendPositionLeft = -4131;   
  xlLegendPositionRight = -4152;   
  xlLegendPositionTop = -4160;   
  xlContinuous = 1;   
  xlDash = -4115;   
  xlDashDot = 4;   
  xlDashDotDot = 5;   
  xlDot = -4118;   
  xlDouble = -4119;   
  xlLineStyleNone = -4142;   
  xlSlantDashDot = 13;   
  xlExcelLinks = 1;   
  xlOLELinks = 2;   
  xlPublishers = 5;   
  xlSubscribers = 6;   
  xlEditionDate = 2;   
  xlLinkInfoStatus = 3;   
  xlUpdateState = 1;   
  xlLinkInfoOLELinks = 2;   
  xlLinkInfoPublishers = 5;   
  xlLinkInfoSubscribers = 6;   
  xlLinkStatusCopiedValues = 10;   
  xlLinkStatusIndeterminate = 5;   
  xlLinkStatusInvalidName = 7;   
  xlLinkStatusMissingFile = 1;   
  xlLinkStatusMissingSheet = 2;   
  xlLinkStatusNotStarted = 6;   
  xlLinkStatusOK = 0;   
  xlLinkStatusOld = 3;   
  xlLinkStatusSourceNotCalculated = 4;   
  xlLinkStatusSourceNotOpen = 8;   
  xlLinkStatusSourceOpen = 9;   
  xlLinkTypeExcelLinks = 1;   
  xlLinkTypeOLELinks = 2;   
  xlListConflictDialog = 0;   
  xlListConflictDiscardAllConflicts = 2;   
  xlListConflictError = 3;   
  xlListConflictRetryAllConflicts = 1;   
  xlListDataTypeCheckbox = 9;   
  xlListDataTypeChoice = 6;   
  xlListDataTypeChoiceMulti = 7;   
  xlListDataTypeCounter = 11;   
  xlListDataTypeCurrency = 4;   
  xlListDataTypeDateTime = 5;   
  xlListDataTypeHyperLink = 10;   
  xlListDataTypeListLookup = 8;   
  xlListDataTypeMultiLineRichText = 12;   
  xlListDataTypeMultiLineText = 2;   
  xlListDataTypeNone = 0;   
  xlListDataTypeNumber = 3;   
  xlListDataTypeText = 1;   
  xlSrcExternal = 0;   
  xlSrcRange = 1;   
  xlSrcXml = 2;   
  xlColumnHeader = -4110;   
  xlColumnItem = 5;   
  xlDataHeader = 3;   
  xlDataItem = 7;   
  xlPageHeader = 2;   
  xlPageItem = 6;   
  xlRowHeader = -4153;   
  xlRowItem = 4;   
  xlTableBody = 8;   
  xlPart = 2;   
  xlWhole = 1;   
  xlMAPI = 1;   
  xlNoMailSystem = 0;   
  xlPowerTalk = 2;   
  xlMarkerStyleAutomatic = -4105;   
  xlMarkerStyleCircle = 8;   
  xlMarkerStyleDash = -4115;   
  xlMarkerStyleDiamond = 2;   
  xlMarkerStyleDot = -4118;   
  xlMarkerStyleNone = -4142;   
  xlMarkerStylePicture = -4147;   
  xlMarkerStylePlus = 9;   
  xlMarkerStyleSquare = 1;   
  xlMarkerStyleStar = 5;   
  xlMarkerStyleTriangle = 3;   
  xlMarkerStyleX = -4168;   
  xlNoButton = 0;   
  xlPrimaryButton = 1;   
  xlSecondaryButton = 2;   
  xlDefault = -4143;   
  xlIBeam = 3;   
  xlNorthwestArrow = 1;   
  xlWait = 2;   
  xlMicrosoftAccess = 4;   
  xlMicrosoftFoxPro = 5;   
  xlMicrosoftMail = 3;   
  xlMicrosoftPowerPoint = 2;   
  xlMicrosoftProject = 6;   
  xlMicrosoftSchedulePlus = 7;   
  xlMicrosoftWord = 1;   
  xlFitToPage = 2;   
  xlFullPage = 3;   
  xlScreenSize = 1;   
  xlOLEControl = 2;   
  xlOLEEmbed = 1;   
  xlOLELink = 0;   
  xlVerbOpen = 2;   
  xlVerbPrimary = 1;   
  xlDownThenOver = 1;   
  xlOverThenDown = 2;   
  xlDownward = -4170;   
  xlHorizontal = -4128;   
  xlUpward = -4171;   
  xlVertical = -4166;   
  xlPageBreakAutomatic = -4105;   
  xlPageBreakManual = -4135;   
  xlPageBreakNone = -4142;   
  xlPageBreakFull = 1;   
  xlPageBreakPartial = 2;   
  xlLandscape = 2;   
  xlPortrait = 1;   
  xlPaper10x14 = 16;   
  xlPaper11x17 = 17;   
  xlPaperA3 = 8;   
  xlPaperA4 = 9;   
  xlPaperA4Small = 10;   
  xlPaperA5 = 11;   
  xlPaperB4 = 12;   
  xlPaperB5 = 13;   
  xlPaperCsheet = 24;   
  xlPaperDsheet = 25;   
  xlPaperEnvelope10 = 20;   
  xlPaperEnvelope11 = 21;   
  xlPaperEnvelope12 = 22;   
  xlPaperEnvelope14 = 23;   
  xlPaperEnvelope9 = 19;   
  xlPaperEnvelopeB4 = 33;   
  xlPaperEnvelopeB5 = 34;   
  xlPaperEnvelopeB6 = 35;   
  xlPaperEnvelopeC3 = 29;   
  xlPaperEnvelopeC4 = 30;   
  xlPaperEnvelopeC5 = 28;   
  xlPaperEnvelopeC6 = 31;   
  xlPaperEnvelopeC65 = 32;   
  xlPaperEnvelopeDL = 27;   
  xlPaperEnvelopeItaly = 36;   
  xlPaperEnvelopeMonarch = 37;   
  xlPaperEnvelopePersonal = 38;   
  xlPaperEsheet = 26;   
  xlPaperExecutive = 7;   
  xlPaperFanfoldLegalGerman = 41;   
  xlPaperFanfoldStdGerman = 40;   
  xlPaperFanfoldUS = 39;   
  xlPaperFolio = 14;   
  xlPaperLedger = 4;   
  xlPaperLegal = 5;   
  xlPaperLetter = 1;   
  xlPaperLetterSmall = 2;   
  xlPaperNote = 18;   
  xlPaperQuarto = 15;   
  xlPaperStatement = 6;   
  xlPaperTabloid = 3;   
  xlPaperUser = 256;   
  xlParamTypeBigInt = -5;   
  xlParamTypeBinary = -2;   
  xlParamTypeBit = -7;   
  xlParamTypeChar = 1;   
  xlParamTypeDate = 9;   
  xlParamTypeDecimal = 3;   
  xlParamTypeDouble = 8;   
  xlParamTypeFloat = 6;   
  xlParamTypeInteger = 4;   
  xlParamTypeLongVarBinary = -4;   
  xlParamTypeLongVarChar = -1;   
  xlParamTypeNumeric = 2;   
  xlParamTypeReal = 7;   
  xlParamTypeSmallInt = 5;   
  xlParamTypeTime = 10;   
  xlParamTypeTimestamp = 11;   
  xlParamTypeTinyInt = -6;   
  xlParamTypeUnknown = 0;   
  xlParamTypeVarBinary = -3;   
  xlParamTypeVarChar = 12;   
  xlParamTypeWChar = -8;   
  xlConstant = 1;   
  xlPrompt = 0;   
  xlRange = 2;   
  xlPasteSpecialOperationAdd = 2;   
  xlPasteSpecialOperationDivide = 5;   
  xlPasteSpecialOperationMultiply = 4;   
  xlPasteSpecialOperationNone = -4142;   
  xlPasteSpecialOperationSubtract = 3;   
  xlPasteAll = -4104;   
  xlPasteAllExceptBorders = 7;   
  xlPasteColumnWidths = 8;   
  xlPasteComments = -4144;   
  xlPasteFormats = -4122;   
  xlPasteFormulas = -4123;   
  xlPasteFormulasAndNumberFormats = 11;   
  xlPasteValidation = 6;   
  xlPasteValues = -4163;   
  xlPasteValuesAndNumberFormats = 12;   
  xlPatternAutomatic = -4105;   
  xlPatternChecker = 9;   
  xlPatternCrissCross = 16;   
  xlPatternDown = -4121;   
  xlPatternGray16 = 17;   
  xlPatternGray25 = -4124;   
  xlPatternGray50 = -4125;   
  xlPatternGray75 = -4126;   
  xlPatternGray8 = 18;   
  xlPatternGrid = 15;   
  xlPatternHorizontal = -4128;   
  xlPatternLightDown = 13;   
  xlPatternLightHorizontal = 11;   
  xlPatternLightUp = 14;   
  xlPatternLightVertical = 12;   
  xlPatternNone = -4142;   
  xlPatternSemiGray75 = 10;   
  xlPatternSolid = 1;   
  xlPatternUp = -4162;   
  xlPatternVertical = -4166;   
  xlPhoneticAlignCenter = 2;   
  xlPhoneticAlignDistributed = 3;   
  xlPhoneticAlignLeft = 1;   
  xlPhoneticAlignNoControl = 0;   
  xlHiragana = 2;   
  xlKatakana = 1;   
  xlKatakanaHalf = 0;   
  xlNoConversion = 3;   
  xlPrinter = 2;   
  xlScreen = 1;   
  xlBMP = 1;   
  xlCGM = 7;   
  xlDRW = 4;   
  xlDXF = 5;   
  xlEPS = 8;   
  xlHGL = 6;   
  xlPCT = 13;   
  xlPCX = 10;   
  xlPIC = 11;   
  xlPLT = 12;   
  xlTIF = 9;   
  xlWMF = 2;   
  xlWPG = 3;   
  xlPivotCellBlankCell = 9;   
  xlPivotCellCustomSubtotal = 7;   
  xlPivotCellDataField = 4;   
  xlPivotCellDataPivotField = 8;   
  xlPivotCellGrandTotal = 3;   
  xlPivotCellPageFieldItem = 6;   
  xlPivotCellPivotField = 5;   
  xlPivotCellPivotItem = 1;   
  xlPivotCellSubtotal = 2;   
  xlPivotCellValue = 0;   
  xlDifferenceFrom = 2;   
  xlIndex = 9;   
  xlNoAdditionalCalculation = -4143;   
  xlPercentDifferenceFrom = 4;   
  xlPercentOf = 3;   
  xlPercentOfColumn = 7;   
  xlPercentOfRow = 6;   
  xlPercentOfTotal = 8;   
  xlRunningTotal = 5;   
  xlDate = 2;   
  xlNumber = -4145;   
  xlText = -4158;   
  xlColumnField = 2;   
  xlDataField = 4;   
  xlHidden = 0;   
  xlPageField = 3;   
  xlRowField = 1;   
  xlPTClassic = 20;   
  xlPTNone = 21;   
  xlReport1 = 0;   
  xlReport10 = 9;   
  xlReport2 = 1;   
  xlReport3 = 2;   
  xlReport4 = 3;   
  xlReport5 = 4;   
  xlReport6 = 5;   
  xlReport7 = 6;   
  xlReport8 = 7;   
  xlReport9 = 8;   
  xlTable1 = 10;   
  xlTable10 = 19;   
  xlTable2 = 11;   
  xlTable3 = 12;   
  xlTable4 = 13;   
  xlTable5 = 14;   
  xlTable6 = 15;   
  xlTable7 = 16;   
  xlTable8 = 17;   
  xlTable9 = 18;   
  xlMissingItemsDefault = -1;   
  xlMissingItemsMax = 32500;   
  xlMissingItemsNone = 0;   
  xlConsolidation = 3;   
  xlDatabase = 1;   
  xlExternal = 2;   
  xlPivotTable = -4148;   
  xlScenario = 4;   
  xlPivotTableVersion10 = 1;   
  xlPivotTableVersion2000 = 0;   
  xlPivotTableVersionCurrent = -1;   
  xlFreeFloating = 3;   
  xlMove = 2;   
  xlMoveAndSize = 1;   
  xlMacintosh = 1;   
  xlMSDOS = 3;   
  xlWindows = 2;   
  xlPrintErrorsBlank = 1;   
  xlPrintErrorsDash = 2;   
  xlPrintErrorsDisplayed = 0;   
  xlPrintErrorsNA = 3;   
  xlPrintInPlace = 16;   
  xlPrintNoComments = -4142;   
  xlPrintSheetEnd = 1;   
  xlPriorityHigh = -4127;   
  xlPriorityLow = -4134;   
  xlPriorityNormal = -4143;   
  xlBlanks = 4;   
  xlButton = 15;   
  xlDataAndLabel = 0;   
  xlDataOnly = 2;   
  xlFirstRow = 256;   
  xlLabelOnly = 1;   
  xlOrigin = 3;   
  xlADORecordset = 7;   
  xlDAORecordset = 2;   
  xlODBCQuery = 1;   
  xlOLEDBQuery = 5;   
  xlTextImport = 6;   
  xlWebQuery = 4;   
  xlRangeAutoFormat3DEffects1 = 13;   
  xlRangeAutoFormat3DEffects2 = 14;   
  xlRangeAutoFormatAccounting1 = 4;   
  xlRangeAutoFormatAccounting2 = 5;   
  xlRangeAutoFormatAccounting3 = 6;   
  xlRangeAutoFormatAccounting4 = 17;   
  xlRangeAutoFormatClassic1 = 1;   
  xlRangeAutoFormatClassic2 = 2;   
  xlRangeAutoFormatClassic3 = 3;   
  xlRangeAutoFormatClassicPivotTable = 31;   
  xlRangeAutoFormatColor1 = 7;   
  xlRangeAutoFormatColor2 = 8;   
  xlRangeAutoFormatColor3 = 9;   
  xlRangeAutoFormatList1 = 10;   
  xlRangeAutoFormatList2 = 11;   
  xlRangeAutoFormatList3 = 12;   
  xlRangeAutoFormatLocalFormat1 = 15;   
  xlRangeAutoFormatLocalFormat2 = 16;   
  xlRangeAutoFormatLocalFormat3 = 19;   
  xlRangeAutoFormatLocalFormat4 = 20;   
  xlRangeAutoFormatNone = -4142;   
  xlRangeAutoFormatPTNone = 42;   
  xlRangeAutoFormatReport1 = 21;   
  xlRangeAutoFormatReport10 = 30;   
  xlRangeAutoFormatReport2 = 22;   
  xlRangeAutoFormatReport3 = 23;   
  xlRangeAutoFormatReport4 = 24;   
  xlRangeAutoFormatReport5 = 25;   
  xlRangeAutoFormatReport6 = 26;   
  xlRangeAutoFormatReport7 = 27;   
  xlRangeAutoFormatReport8 = 28;   
  xlRangeAutoFormatReport9 = 29;   
  xlRangeAutoFormatSimple = -4154;   
  xlRangeAutoFormatTable1 = 32;   
  xlRangeAutoFormatTable10 = 41;   
  xlRangeAutoFormatTable2 = 33;   
  xlRangeAutoFormatTable3 = 34;   
  xlRangeAutoFormatTable4 = 35;   
  xlRangeAutoFormatTable5 = 36;   
  xlRangeAutoFormatTable6 = 37;   
  xlRangeAutoFormatTable7 = 38;   
  xlRangeAutoFormatTable8 = 39;   
  xlRangeAutoFormatTable9 = 40;   
  xlRangeValueDefault = 10;   
  xlRangeValueMSPersistXML = 12;   
  xlRangeValueXMLSpreadsheet = 11;   
  xlA1 = 1;   
  xlR1C1 = -4150;   
  xlAbsolute = 1;   
  xlAbsRowRelColumn = 2;   
  xlRelative = 4;   
  xlRelRowAbsColumn = 3;   
  xlAlways = 1;   
  xlAsRequired = 0;   
  xlNever = 2;   
  xlAllAtOnce = 2;   
  xlOneAfterAnother = 1;   
  xlNotYetRouted = 0;   
  xlRoutingComplete = 2;   
  xlRoutingInProgress = 1;   
  xlColumns = 2;   
  xlRows = 1;   
  xlAutoActivate = 3;   
  xlAutoClose = 2;   
  xlAutoDeactivate = 4;   
  xlAutoOpen = 1;   
  xlDoNotSaveChanges = 2;   
  xlSaveChanges = 1;   
  xlExclusive = 3;   
  xlNoChange = 1;   
  xlShared = 2;   
  xlLocalSessionChanges = 2;   
  xlOtherSessionChanges = 3;   
  xlUserResolution = 1;   
  xlScaleLinear = -4132;   
  xlScaleLogarithmic = -4133;   
  xlNext = 1;   
  xlPrevious = 2;   
  xlByColumns = 2;   
  xlByRows = 1;   
  xlWithinSheet = 1;   
  xlWithinWorkbook = 2;   
  xlChart = -4109;   
  xlDialogSheet = -4116;   
  xlExcel4IntlMacroSheet = 4;   
  xlExcel4MacroSheet = 3;   
  xlWorksheet = -4167;   
  xlSheetHidden = 0;   
  xlSheetVeryHidden = 2;   
  xlSheetVisible = -1;   
  xlSizeIsArea = 1;   
  xlSizeIsWidth = 2;   
  xlSmartTagControlActiveX = 13;   
  xlSmartTagControlButton = 6;   
  xlSmartTagControlCheckbox = 9;   
  xlSmartTagControlCombo = 12;   
  xlSmartTagControlHelp = 3;   
  xlSmartTagControlHelpURL = 4;   
  xlSmartTagControlImage = 8;   
  xlSmartTagControlLabel = 7;   
  xlSmartTagControlLink = 2;   
  xlSmartTagControlListbox = 11;   
  xlSmartTagControlRadioGroup = 14;   
  xlSmartTagControlSeparator = 5;   
  xlSmartTagControlSmartTag = 1;   
  xlSmartTagControlTextbox = 10;   
  xlButtonOnly = 2;   
  xlDisplayNone = 1;   
  xlIndicatorAndButton = 0;   
  xlSortNormal = 0;   
  xlSortTextAsNumbers = 1;   
  xlPinYin = 1;   
  xlStroke = 2;   
  xlCodePage = 2;   
  xlSyllabary = 1;   
  xlAscending = 1;   
  xlDescending = 2;   
  xlSortColumns = 1;   
  xlSortRows = 2;   
  xlSortLabels = 2;   
  xlSortValues = 1;   
  xlSourceAutoFilter = 3;   
  xlSourceChart = 5;   
  xlSourcePivotTable = 6;   
  xlSourcePrintArea = 2;   
  xlSourceQuery = 7;   
  xlSourceRange = 4;   
  xlSourceSheet = 1;   
  xlSourceWorkbook = 0;   
  xlSpeakByColumns = 1;   
  xlSpeakByRows = 0;   
  xlErrors = 16;   
  xlLogical = 4;   
  xlNumbers = 1;   
  xlTextValues = 2;   
  xlSubscribeToPicture = -4147;   
  xlSubscribeToText = -4158;   
  xlAtBottom = 2;   
  xlAtTop = 1;   
  xlSummaryOnLeft = -4131;   
  xlSummaryOnRight = -4152;   
  xlStandardSummary = 1;   
  xlSummaryPivotTable = -4148;   
  xlSummaryAbove = 0;   
  xlSummaryBelow = 1;   
  xlTabPositionFirst = 0;   
  xlTabPositionLast = 1;   
  xlDelimited = 1;   
  xlFixedWidth = 2;   
  xlTextQualifierDoubleQuote = 1;   
  xlTextQualifierNone = -4142;   
  xlTextQualifierSingleQuote = 2;   
  xlTextVisualLTR = 1;   
  xlTextVisualRTL = 2;   
  xlTickLabelOrientationAutomatic = -4105;   
  xlTickLabelOrientationDownward = -4170;   
  xlTickLabelOrientationHorizontal = -4128;   
  xlTickLabelOrientationUpward = -4171;   
  xlTickLabelOrientationVertical = -4166;   
  xlTickLabelPositionHigh = -4127;   
  xlTickLabelPositionLow = -4134;   
  xlTickLabelPositionNextToAxis = 4;   
  xlTickLabelPositionNone = -4142;   
  xlTickMarkCross = 4;   
  xlTickMarkInside = 2;   
  xlTickMarkNone = -4142;   
  xlTickMarkOutside = 3;   
  xlDays = 0;   
  xlMonths = 1;   
  xlYears = 2;   
  xlNoButtonChanges = 1;   
  xlNoChanges = 4;   
  xlNoDockingChanges = 3;   
  xlNoShapeChanges = 2;   
  xlToolbarProtectionNone = -4143;   
  xlTotalsCalculationAverage = 2;   
  xlTotalsCalculationCount = 3;   
  xlTotalsCalculationCountNums = 4;   
  xlTotalsCalculationMax = 6;   
  xlTotalsCalculationMin = 5;   
  xlTotalsCalculationNone = 0;   
  xlTotalsCalculationStdDev = 7;   
  xlTotalsCalculationSum = 1;   
  xlTotalsCalculationVar = 8;   
  xlExponential = 5;   
  xlLinear = -4132;   
  xlLogarithmic = -4133;   
  xlMovingAvg = 6;   
  xlPolynomial = 3;   
  xlPower = 4;   
  xlUnderlineStyleDouble = -4119;   
  xlUnderlineStyleDoubleAccounting = 5;   
  xlUnderlineStyleNone = -4142;   
  xlUnderlineStyleSingle = 2;   
  xlUnderlineStyleSingleAccounting = 4;   
  xlUpdateLinksAlways = 3;   
  xlUpdateLinksNever = 2;   
  xlUpdateLinksUserSetting = 1;   
  xlVAlignBottom = -4107;   
  xlVAlignCenter = -4108;   
  xlVAlignDistributed = -4117;   
  xlVAlignJustify = -4130;   
  xlVAlignTop = -4160;   
  xlWBATChart = -4109;   
  xlWBATExcel4IntlMacroSheet = 4;   
  xlWBATExcel4MacroSheet = 3;   
  xlWBATWorksheet = -4167;   
  xlWebFormattingAll = 1;   
  xlWebFormattingNone = 3;   
  xlWebFormattingRTF = 2;   
  xlAllTables = 2;   
  xlEntirePage = 1;   
  xlSpecifiedTables = 3;   
  xlMaximized = -4137;   
  xlMinimized = -4140;   
  xlNormal = -4143;   
  xlChartAsWindow = 5;   
  xlChartInPlace = 4;   
  xlClipboard = 3;   
  xlInfo = -4129;   
  xlWorkbook = 1;   
  xlNormalView = 1;   
  xlPageBreakPreview = 2;   
  xlCommand = 2;   
  xlFunction = 1;   
  xlNotXLM = 3;   
  xlXmlExportSuccess = 0;   
  xlXmlExportValidationFailed = 1;   
  xlXmlImportElementsTruncated = 1;   
  xlXmlImportSuccess = 0;   
  xlXmlImportValidationFailed = 2;   
  xlXmlLoadImportToList = 2;   
  xlXmlLoadMapXml = 3;   
  xlXmlLoadOpenXml = 1;   
  xlXmlLoadPromptUser = 0;   
  xlGuess = 0;   
  xlNo = 2;   
  xlYes = 1;
2015-05-12 20:51
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25859
专家分:48889
注 册:2011-6-22
收藏
得分:0 
数据尤其字符串处理是vfp的强项,你不会用vfp把数据替换好再入cell?改用Excel的vba处理比任何一种单纯的手段都慢。用vfp调Excel是想利用它的制表功能,数据处理不需绕这么大一个圈的。

授人以渔,不授人以鱼。
2015-05-12 20:57
cnsgh
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2015-3-30
收藏
得分:0 
嗯,特殊需求呀
数值型字段不能是空值,而我导出的excel有许多0非常碍眼,
如果把字段弄成字符型,导出到excel也就变成文本型的了,如果再想处理这些文本型的数字太麻烦了,
所以在想在导出后来替换值为0的单元格为空,这样看着清晰点
2015-05-12 21:04
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9841
专家分:27213
注 册:2012-2-5
收藏
得分:5 
6、当前屏不显示零值
oExcel.ActiveWindow.DisplayZeros=.F.

以后提问题要直接了当,意思表达要一步到位,不要拐弯抹角

坚守VFP最后的阵地
2015-05-12 22:18
tlliqi
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
等 级:贵宾
威 望:204
帖 子:15453
专家分:65956
注 册:2006-4-27
收藏
得分:5 
以下是引用cnsgh在2015-5-12 20:51:56的发言:

我是想把导出的excel表直接再vfp中处理成可直接打印的样式,所以有这需求,呵呵
按格式应该是eole.Cells.REPLACE("0","",xlwhole)这样
 xlWhole不能直接用上,折腾了好久没解决,刚发现这里是需要用Excel常量单元的
  xlWhole 的常量单元式 1  
也就是说eole.Cells.REPLACE("0","",1) 就解决了 单元格匹配问题了。
 
(自己解决了,帖子怎么处理来着??)
下面是搜到的Delphi Excel常量单元 好像是通用的,在这里记录下
xlBetween = 1;   
  xlEqual = 3;   
  xlGreater = 5;   
  xlGreaterEqual = 7;   
  xlLess = 6;   
  xlLessEqual = 8;   
  xlNotBetween = 2;   
  xlNotEqual = 4;   
  xlCellValue = 1;   
  xlExpression = 2;   
  xlButtonControl = 0;   
  xlCheckBox = 1;   
  xlDropDown = 2;   
  xlEditBox = 3;   
  xlGroupBox = 4;   
  xlLabel = 5;   
  xlListBox = 6;   
  xlOptionButton = 7;   
  xlScrollBar = 8;   
  xlSpinner = 9;   
  xlColumnLabels = 2;   
  xlMixedLabels = 3;   
  xlNoLabels = -4142;   
  xlRowLabels = 1;   
  xlHAlignCenter = -4108;   
  xlHAlignCenterAcrossSelection = 7;   
  xlHAlignDistributed = -4117;   
  xlHAlignFill = 5;   
  xlHAlignGeneral = 1;   
  xlHAlignJustify = -4130;   
  xlHAlignLeft = -4131;   
  xlHAlignRight = -4152;   
  xlHebrewFullScript = 0;   
  xlHebrewMixedAuthorizedScript = 3;   
  xlHebrewMixedScript = 2;   
  xlHebrewPartialScript = 1;   
  xlAllChanges = 2;   
  xlNotYetReviewed = 3;   
  xlSinceMyLastSave = 1;   
  xlHtmlCalc = 1;   
  xlHtmlChart = 3;   
  xlHtmlList = 2;   
  xlHtmlStatic = 0;   
  xlIMEModeAlpha = 8;   
  xlIMEModeAlphaFull = 7;   
  xlIMEModeDisable = 3;   
  xlIMEModeHangul = 10;   
  xlIMEModeHangulFull = 9;   
  xlIMEModeHiragana = 4;   
  xlIMEModeKatakana = 5;   
  xlIMEModeKatakanaHalf = 6;   
  xlIMEModeNoControl = 0;   
  xlIMEModeOff = 2;   
  xlIMEModeOn = 1;   
  xlPivotTableReport = 1;   
  xlQueryTable = 0;   
  xlFormatFromLeftOrAbove = 0;   
  xlFormatFromRightOrBelow = 1;   
  xlShiftDown = -4121;   
  xlShiftToRight = -4161;   
  xlOutline = 1;   
  xlTabular = 0;   
  xlLegendPositionBottom = -4107;   
  xlLegendPositionCorner = 2;   
  xlLegendPositionLeft = -4131;   
  xlLegendPositionRight = -4152;   
  xlLegendPositionTop = -4160;   
  xlContinuous = 1;   
  xlDash = -4115;   
  xlDashDot = 4;   
  xlDashDotDot = 5;   
  xlDot = -4118;   
  xlDouble = -4119;   
  xlLineStyleNone = -4142;   
  xlSlantDashDot = 13;   
  xlExcelLinks = 1;   
  xlOLELinks = 2;   
  xlPublishers = 5;   
  xlSubscribers = 6;   
  xlEditionDate = 2;   
  xlLinkInfoStatus = 3;   
  xlUpdateState = 1;   
  xlLinkInfoOLELinks = 2;   
  xlLinkInfoPublishers = 5;   
  xlLinkInfoSubscribers = 6;   
  xlLinkStatusCopiedValues = 10;   
  xlLinkStatusIndeterminate = 5;   
  xlLinkStatusInvalidName = 7;   
  xlLinkStatusMissingFile = 1;   
  xlLinkStatusMissingSheet = 2;   
  xlLinkStatusNotStarted = 6;   
  xlLinkStatusOK = 0;   
  xlLinkStatusOld = 3;   
  xlLinkStatusSourceNotCalculated = 4;   
  xlLinkStatusSourceNotOpen = 8;   
  xlLinkStatusSourceOpen = 9;   
  xlLinkTypeExcelLinks = 1;   
  xlLinkTypeOLELinks = 2;   
  xlListConflictDialog = 0;   
  xlListConflictDiscardAllConflicts = 2;   
  xlListConflictError = 3;   
  xlListConflictRetryAllConflicts = 1;   
  xlListDataTypeCheckbox = 9;   
  xlListDataTypeChoice = 6;   
  xlListDataTypeChoiceMulti = 7;   
  xlListDataTypeCounter = 11;   
  xlListDataTypeCurrency = 4;   
  xlListDataTypeDateTime = 5;   
  xlListDataTypeHyperLink = 10;   
  xlListDataTypeListLookup = 8;   
  xlListDataTypeMultiLineRichText = 12;   
  xlListDataTypeMultiLineText = 2;   
  xlListDataTypeNone = 0;   
  xlListDataTypeNumber = 3;   
  xlListDataTypeText = 1;   
  xlSrcExternal = 0;   
  xlSrcRange = 1;   
  xlSrcXml = 2;   
  xlColumnHeader = -4110;   
  xlColumnItem = 5;   
  xlDataHeader = 3;   
  xlDataItem = 7;   
  xlPageHeader = 2;   
  xlPageItem = 6;   
  xlRowHeader = -4153;   
  xlRowItem = 4;   
  xlTableBody = 8;   
  xlPart = 2;   
  xlWhole = 1;   
  xlMAPI = 1;   
  xlNoMailSystem = 0;   
  xlPowerTalk = 2;   
  xlMarkerStyleAutomatic = -4105;   
  xlMarkerStyleCircle = 8;   
  xlMarkerStyleDash = -4115;   
  xlMarkerStyleDiamond = 2;   
  xlMarkerStyleDot = -4118;   
  xlMarkerStyleNone = -4142;   
  xlMarkerStylePicture = -4147;   
  xlMarkerStylePlus = 9;   
  xlMarkerStyleSquare = 1;   
  xlMarkerStyleStar = 5;   
  xlMarkerStyleTriangle = 3;   
  xlMarkerStyleX = -4168;   
  xlNoButton = 0;   
  xlPrimaryButton = 1;   
  xlSecondaryButton = 2;   
  xlDefault = -4143;   
  xlIBeam = 3;   
  xlNorthwestArrow = 1;   
  xlWait = 2;   
  xlMicrosoftAccess = 4;   
  xlMicrosoftFoxPro = 5;   
  xlMicrosoftMail = 3;   
  xlMicrosoftPowerPoint = 2;   
  xlMicrosoftProject = 6;   
  xlMicrosoftSchedulePlus = 7;   
  xlMicrosoftWord = 1;   
  xlFitToPage = 2;   
  xlFullPage = 3;   
  xlScreenSize = 1;   
  xlOLEControl = 2;   
  xlOLEEmbed = 1;   
  xlOLELink = 0;   
  xlVerbOpen = 2;   
  xlVerbPrimary = 1;   
  xlDownThenOver = 1;   
  xlOverThenDown = 2;   
  xlDownward = -4170;   
  xlHorizontal = -4128;   
  xlUpward = -4171;   
  xlVertical = -4166;   
  xlPageBreakAutomatic = -4105;   
  xlPageBreakManual = -4135;   
  xlPageBreakNone = -4142;   
  xlPageBreakFull = 1;   
  xlPageBreakPartial = 2;   
  xlLandscape = 2;   
  xlPortrait = 1;   
  xlPaper10x14 = 16;   
  xlPaper11x17 = 17;   
  xlPaperA3 = 8;   
  xlPaperA4 = 9;   
  xlPaperA4Small = 10;   
  xlPaperA5 = 11;   
  xlPaperB4 = 12;   
  xlPaperB5 = 13;   
  xlPaperCsheet = 24;   
  xlPaperDsheet = 25;   
  xlPaperEnvelope10 = 20;   
  xlPaperEnvelope11 = 21;   
  xlPaperEnvelope12 = 22;   
  xlPaperEnvelope14 = 23;   
  xlPaperEnvelope9 = 19;   
  xlPaperEnvelopeB4 = 33;   
  xlPaperEnvelopeB5 = 34;   
  xlPaperEnvelopeB6 = 35;   
  xlPaperEnvelopeC3 = 29;   
  xlPaperEnvelopeC4 = 30;   
  xlPaperEnvelopeC5 = 28;   
  xlPaperEnvelopeC6 = 31;   
  xlPaperEnvelopeC65 = 32;   
  xlPaperEnvelopeDL = 27;   
  xlPaperEnvelopeItaly = 36;   
  xlPaperEnvelopeMonarch = 37;   
  xlPaperEnvelopePersonal = 38;   
  xlPaperEsheet = 26;   
  xlPaperExecutive = 7;   
  xlPaperFanfoldLegalGerman = 41;   
  xlPaperFanfoldStdGerman = 40;   
  xlPaperFanfoldUS = 39;   
  xlPaperFolio = 14;   
  xlPaperLedger = 4;   
  xlPaperLegal = 5;   
  xlPaperLetter = 1;   
  xlPaperLetterSmall = 2;   
  xlPaperNote = 18;   
  xlPaperQuarto = 15;   
  xlPaperStatement = 6;   
  xlPaperTabloid = 3;   
  xlPaperUser = 256;   
  xlParamTypeBigInt = -5;   
  xlParamTypeBinary = -2;   
  xlParamTypeBit = -7;   
  xlParamTypeChar = 1;   
  xlParamTypeDate = 9;   
  xlParamTypeDecimal = 3;   
  xlParamTypeDouble = 8;   
  xlParamTypeFloat = 6;   
  xlParamTypeInteger = 4;   
  xlParamTypeLongVarBinary = -4;   
  xlParamTypeLongVarChar = -1;   
  xlParamTypeNumeric = 2;   
  xlParamTypeReal = 7;   
  xlParamTypeSmallInt = 5;   
  xlParamTypeTime = 10;   
  xlParamTypeTimestamp = 11;   
  xlParamTypeTinyInt = -6;   
  xlParamTypeUnknown = 0;   
  xlParamTypeVarBinary = -3;   
  xlParamTypeVarChar = 12;   
  xlParamTypeWChar = -8;   
  xlConstant = 1;   
  xlPrompt = 0;   
  xlRange = 2;   
  xlPasteSpecialOperationAdd = 2;   
  xlPasteSpecialOperationDivide = 5;   
  xlPasteSpecialOperationMultiply = 4;   
  xlPasteSpecialOperationNone = -4142;   
  xlPasteSpecialOperationSubtract = 3;   
  xlPasteAll = -4104;   
  xlPasteAllExceptBorders = 7;   
  xlPasteColumnWidths = 8;   
  xlPasteComments = -4144;   
  xlPasteFormats = -4122;   
  xlPasteFormulas = -4123;   
  xlPasteFormulasAndNumberFormats = 11;   
  xlPasteValidation = 6;   
  xlPasteValues = -4163;   
  xlPasteValuesAndNumberFormats = 12;   
  xlPatternAutomatic = -4105;   
  xlPatternChecker = 9;   
  xlPatternCrissCross = 16;   
  xlPatternDown = -4121;   
  xlPatternGray16 = 17;   
  xlPatternGray25 = -4124;  ...
Excel常量表
2015-05-13 00:40
hu9jj
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:红土地
等 级:贵宾
威 望:400
帖 子:11857
专家分:43421
注 册:2006-5-13
收藏
得分:5 
楼主发那么长的代码,就不怕把老静的硬盘撑爆。

活到老,学到老!http://www.(该域名已经被ISP盗卖了)E-mail:hu-jj@
2015-05-13 07:46
cnsgh
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2015-3-30
收藏
得分:0 
以下是引用sdta在2015-5-12 22:18:38的发言:

6、当前屏不显示零值
oExcel.ActiveWindow.DisplayZeros=.F.

以后提问题要直接了当,意思表达要一步到位,不要拐弯抹角



还可以这样呀,我的方法太笨了。。只知道替换掉0.。。
汗~~~
2015-05-13 09:19
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25859
专家分:48889
注 册:2011-6-22
收藏
得分:0 
不用那个也可以的,其实对每个单元格都使用一次这个ole远程调用,执行效率会下降,较为高效的办法是选中需要设置格式的所有单元格,再一次使用这个调用,这是中策,更高效的方法,就是在写入单元格的时候事先就用vfp在本地(自己的进程内存中)处理好了,直接写入。数值为零以及任何不需显示内容的,直接跳过写入步骤,根本就不写出去,那本来就是空白,不用搞那么多复杂的动作。记住:代码中if语句多,效率反而更高,因为很多语句实际上是没执行的,不是代码量少程序就高效,少写几行代码,省了自己一时半会的功夫,但代价是程序长久执行多余的指令消耗时间,影响应用体验。

我见很多人追求一行代码或一句指令,故多说几句而已,可以当我放屁。反正问题已经解决了,不是吗。https://bbs.bccn.net/thread-445313-1-1.html

[ 本帖最后由 TonyDeng 于 2015-5-15 12:19 编辑 ]

授人以渔,不授人以鱼。
2015-05-15 12:14
快速回复:请问vfp操作excel表替换问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.052130 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved