{"id":1489,"date":"2025-11-17T15:46:57","date_gmt":"2025-11-17T07:46:57","guid":{"rendered":"http:\/\/www.dxQerp.com\/?p=1489"},"modified":"2026-01-24T08:14:11","modified_gmt":"2026-01-24T00:14:11","slug":"dbase-2019-excel-%e6%ac%84%e4%bd%8d-%e4%bd%bf%e7%94%a8-%e5%85%ac%e5%bc%8f","status":"publish","type":"post","link":"http:\/\/www.dxQerp.com\/?p=1489","title":{"rendered":"dbase 2019  EXCEL \u6b04\u4f4d \u4f7f\u7528  \u516c\u5f0f"},"content":{"rendered":"<p>\u60a8\u9019\u6bb5\u7a0b\u5f0f\u78bc\u662f\u7528 dBASE \u8a9e\u6cd5\u64cd\u4f5c Excel COM \u5c0d\u8c61\uff0c\u6838\u5fc3\u76ee\u6a19\u662f\u5c07\u8cc7\u6599\u5beb\u5165 Excel \u5132\u5b58\u683c\uff08Cell\uff09\u3002<\/p>\n<p>\u60a8\u60f3\u5c07\u539f\u672c\u5beb\u5165\u8cc7\u6599\u5eab\u6b04\u4f4d\u503c R.fields[&#8216;\u8907\u50f9&#8217;].value \u7684\u64cd\u4f5c\uff0c\u6539\u6210\u5beb\u5165\u4e00\u500b Excel \u516c\u5f0f &#8220;=\u55ae\u50f9*\u6578\u91cf&#8221;\u3002<\/p>\n<p>\u8981\u5be6\u73fe\u9019\u500b\u76ee\u6a19\uff0c\u60a8\u53ea\u9700\u8981\u66f4\u6539\u8ce6\u503c\u7d66 formula \u5c6c\u6027\u7684\u5167\u5bb9\u5373\u53ef\u3002<\/p>\n<p>&#x1f6e0;&#xfe0f; \u5982\u4f55\u5c07\u7a0b\u5f0f\u78bc\u6539\u70ba\u5beb\u5165 Excel \u516c\u5f0f<br \/>\n\u5728\u60a8\u63d0\u4f9b\u7684\u7a0b\u5f0f\u78bc\u4e2d\uff0coCell \u662f Excel \u5132\u5b58\u683c\u5c0d\u8c61\uff0cformula \u5c6c\u6027\u7528\u65bc\u8a2d\u5b9a\u5132\u5b58\u683c\u7684\u5167\u5bb9\uff0c\u7279\u5225\u662f\u516c\u5f0f\u3002<\/p>\n<p>\u539f\u7a0b\u5f0f\u78bc (\u5beb\u5165\u503c)\uff1a<\/p>\n<p>\u7a0b\u5f0f\u78bc\u7247\u6bb5<\/p>\n<p>if (R.fields[&#8216;\u8907\u50f9&#8217;].value)&gt;0<br \/>\noCell = o.ActiveSheet.cells( nRow, 6+(N-65) )<br \/>\nwith ( oCell )<br \/>\nformula := R.fields[&#8216;\u8907\u50f9&#8217;].value \/\/ \u5beb\u5165\u6b04\u4f4d\u7684\u503c<br \/>\nFont.ColorIndex := 5<br \/>\nendwith<br \/>\nendif<br \/>\n\u4fee\u6539\u5f8c\u7684\u7a0b\u5f0f\u78bc (\u5beb\u5165\u516c\u5f0f)\uff1a<\/p>\n<p>\u60a8\u53ea\u9700\u8981\u5c07 R.fields[&#8216;\u8907\u50f9&#8217;].value \u66ff\u63db\u70ba\u5305\u542b\u60a8\u6240\u9700\u516c\u5f0f\u7684\u5b57\u4e32\u3002\u5728 Excel \u4e2d\uff0c\u516c\u5f0f\u5fc5\u9808\u4ee5\u7b49\u865f (=) \u958b\u982d\u3002<\/p>\n<p>\u7a0b\u5f0f\u78bc\u7247\u6bb5<\/p>\n<p>\/\/ \u5047\u8a2d\u60a8\u60f3\u5728\u4efb\u4f55\u60c5\u6cc1\u4e0b\u90fd\u5beb\u5165\u9019\u500b\u516c\u5f0f<br \/>\n\/\/ \u6ce8\u610f\uff1a\u9019\u88e1\u5047\u8a2d\u55ae\u50f9\u548c\u6578\u91cf\u6b04\u4f4d\u5728 Excel \u4e2d\u6709\u56fa\u5b9a\u7684\u4f4d\u7f6e\u3002<br \/>\n\/\/ \u70ba\u4e86\u8b93\u516c\u5f0f\u53ef\u4ee5\u6b63\u5e38\u904b\u4f5c\uff0c\u60a8\u9700\u8981\u77e5\u9053\u201c\u55ae\u50f9\u201d\u548c\u201c\u6578\u91cf\u201d\u6240\u5728\u7684\u6b04\u4f4d\u5b57\u6bcd\u6216\u6578\u5b57\uff0c<br \/>\n\/\/ \u4e26\u4f7f\u7528 Excel \u7684 R1C1 \u6216 A1 \u5f15\u7528\u683c\u5f0f\u3002<\/p>\n<p>\/\/ \u7bc4\u4f8b\uff1a\u5047\u8a2d\u55ae\u50f9\u662f\u540c\u4e00\u5217\u7684\u7b2c D \u6b04\uff0c\u6578\u91cf\u662f\u540c\u4e00\u5217\u7684\u7b2c E \u6b04\u3002<br \/>\n\/\/ \u4e14 oCell \u662f\u5728\u7b2c F \u6b04 (\u7b2c nRow \u5217)<\/p>\n<p>\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n\/\/ **\u9078\u9805 1: \u4f7f\u7528 Formula (A1 \u5f15\u7528\u683c\u5f0f)**<br \/>\n\/\/ A1 \u683c\u5f0f (\u5982 B2, C2) \u5728\u8907\u88fd\u516c\u5f0f\u6642\u6703\u81ea\u52d5\u8abf\u6574\u884c\u865f\u3002<br \/>\n\/\/ \u9019\u901a\u5e38\u662f\u60a8\u60f3\u8981\u7684\uff1a<br \/>\n\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>oCell = o.ActiveSheet.cells( nRow, 6+(N-65) )<br \/>\nwith ( oCell )<br \/>\n\/\/ \u5047\u8a2d\u300c\u55ae\u50f9\u300d\u662f\u540c\u4e00\u5217\u7684\u7b2c 4 \u6b04 (D\u6b04)\uff0c\u300c\u6578\u91cf\u300d\u662f\u7b2c 5 \u6b04 (E\u6b04)<br \/>\n\/\/ \u60a8\u7684\u516c\u5f0f\u5c31\u6703\u662f &#8220;=D[nRow]*E[nRow]&#8221;<br \/>\nformula := &#8220;=D&#8221; + STR(nRow) + &#8220;*E&#8221; + STR(nRow)<\/p>\n<p>\/\/ \u5982\u679c\u60a8\u60f3\u4f7f\u7528 Excel \u7684\u672c\u5730\u5316\u516c\u5f0f\u5c6c\u6027 (FormulaLocal)<br \/>\n\/\/ \u78ba\u4fdd\u516c\u5f0f\u4ee5\u7b49\u865f\u958b\u982d\uff0c\u4e26\u4f7f\u7528\u60a8\u7a0b\u5f0f\u8a9e\u8a00\u4e2d\u7684\u5b57\u4e32\u8868\u9054\u5f0f\u3002<br \/>\n\/\/ \u9019\u88e1\u6211\u5011\u76f4\u63a5\u4f7f\u7528 Formula \u5c6c\u6027\uff0c\u5b83\u63a5\u53d7\u901a\u7528\u82f1\u6587\u683c\u5f0f\u7684\u516c\u5f0f\u3002<\/p>\n<p>\/\/ \u5982\u679c\u4e0d\u78ba\u5b9a\u55ae\u50f9\u548c\u6578\u91cf\u5728\u54ea\u4e00\u6b04\uff0c\u9019\u88e1\u4f7f\u7528\u4e00\u500b**\u4f54\u4f4d\u7b26**\uff1a<br \/>\n\/\/ formula := &#8220;=A&#8221; + STR(nRow) + &#8220;*B&#8221; + STR(nRow)<\/p>\n<p>Font.ColorIndex := 5<br \/>\nendwith<\/p>\n<p>\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n\/\/ **\u9078\u9805 2: \u4f7f\u7528 FormulaR1C1 (R1C1 \u5f15\u7528\u683c\u5f0f) &#8211; \u63a8\u85a6**<br \/>\n\/\/ R1C1 \u683c\u5f0f (\u5982 R[0]C[-1]) \u5141\u8a31\u60a8\u5f15\u7528\u76f8\u5c0d\u4f4d\u7f6e\u7684\u5132\u5b58\u683c\uff0c\u9019\u5728\u8ff4\u5708\u4e2d\u975e\u5e38\u65b9\u4fbf\u3002<br \/>\n\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>\/\/ \u5047\u8a2d oCell \u662f\u7576\u524d\u8981\u5beb\u5165\u7684\u5132\u5b58\u683c\u3002<br \/>\n\/\/ \u5982\u679c\u55ae\u50f9\u5728\u5de6\u908a\u6578\u5169\u6b04 (C[-2])\uff0c\u6578\u91cf\u5728\u5de6\u908a\u6578\u4e00\u6b04 (C[-1])\uff0c\u5247\uff1a<br \/>\noCell = o.ActiveSheet.cells( nRow, 6+(N-65) )<br \/>\nwith ( oCell )<br \/>\n\/\/ R[0]C[-2] \u8868\u793a\uff1a\u540c\u4e00\u884c (R[0])\uff0c\u7576\u524d\u6b04\u4f4d\u5f80\u5de6\u5169\u6b04 (C[-2])<br \/>\n\/\/ R[0]C[-1] \u8868\u793a\uff1a\u540c\u4e00\u884c (R[0])\uff0c\u7576\u524d\u6b04\u4f4d\u5f80\u5de6\u4e00\u6b04 (C[-1])<br \/>\nFormulaR1C1 := &#8220;=R[0]C[-2]*R[0]C[-1]&#8221;<br \/>\nFont.ColorIndex := 5<br \/>\nendwith<br \/>\n\u95dc\u65bc IF \u689d\u4ef6\u7684\u8655\u7406<br \/>\n\u60a8\u539f\u4f86\u7684\u7a0b\u5f0f\u78bc\u6709\u4e00\u500b IF \u5224\u65b7\uff1a<\/p>\n<p>\u7a0b\u5f0f\u78bc\u7247\u6bb5<\/p>\n<p>if (R.fields[&#8216;\u8907\u50f9&#8217;].value)&gt;0<br \/>\n\/\/ &#8230; \u57f7\u884c\u5beb\u5165 &#8230;<br \/>\nendif<br \/>\n\u5982\u679c\u60a8\u6539\u6210\u5beb\u5165\u516c\u5f0f\uff0c\u60a8\u53ef\u80fd\u5c31\u4e0d\u518d\u9700\u8981\u9019\u500b IF \u5224\u65b7\uff0c\u56e0\u70ba\u516c\u5f0f\u6703\u5728 Excel \u4e2d\u81ea\u52d5\u8a08\u7b97\u3002\u5982\u679c\u60a8\u5805\u6301\u5728\u7279\u5b9a\u689d\u4ef6\u4e0b\u624d\u5beb\u5165\u516c\u5f0f\uff0c\u60a8\u53ef\u4ee5\u4fdd\u7559 IF \u7d50\u69cb\uff0c\u53ea\u9700\u66ff\u63db\u5167\u90e8\u7684\u8ce6\u503c\u5373\u53ef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u60a8\u9019\u6bb5\u7a0b\u5f0f\u78bc\u662f\u7528 dBASE \u8a9e\u6cd5\u64cd\u4f5c Excel COM \u5c0d\u8c61\uff0c\u6838\u5fc3\u76ee\u6a19\u662f\u5c07\u8cc7\u6599\u5beb\u5165 Excel \u5132\u5b58\u683c\uff08C [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[2],"tags":[],"class_list":["post-1489","post","type-post","status-publish","format-standard","hentry","category-dbase-problems"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/posts\/1489","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1489"}],"version-history":[{"count":1,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/posts\/1489\/revisions"}],"predecessor-version":[{"id":1490,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/posts\/1489\/revisions\/1490"}],"wp:attachment":[{"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1489"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1489"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}