{"id":819,"date":"2022-07-19T18:00:59","date_gmt":"2022-07-19T10:00:59","guid":{"rendered":"https:\/\/huiyu1688.top\/?p=819"},"modified":"2022-07-19T18:00:59","modified_gmt":"2022-07-19T10:00:59","slug":"coreldraw_%e5%ae%8f%e6%8f%90%e4%be%9b%e8%b7%af%e5%be%84%e5%b9%b6%e8%87%aa%e5%8a%a8%e5%af%bc%e5%85%a5%e8%b7%af%e5%be%84%e4%b8%ad%e7%9a%84%e5%9b%be%e7%89%87%e5%81%9a%e6%88%90%e6%af%8f%e4%b8%aa","status":"publish","type":"post","link":"https:\/\/hy68.top\/index.php\/2022\/07\/19\/819\/","title":{"rendered":"[coreldraw_\u5b8f]\u63d0\u4f9b\u8def\u5f84\u5e76\u81ea\u52a8\u5bfc\u5165\u8def\u5f84\u4e2d\u7684\u56fe\u7247\u505a\u6210\u6bcf\u4e2a\u9875\u9762(vba\u5b8f)"},"content":{"rendered":"\n<pre class=\"wp-block-code has-black-color has-text-color\"><code>\nSub main()    \n    '==================================================================\n    '\u6587\u4ef6\u540d\uff1a\u63d0\u4f9b\u8def\u5f84\u5e76\u81ea\u52a8\u5bfc\u5165\u56fe\u7247\u505a\u6210\u6bcf\u4e2a\u9875\u9762_\u5b8f\n    '--------------------------------------------------------------\n    '   \u529f\u80fd\u8bf4\u660e\uff1a\n    '       \u4f7f\u7528\u8005\u63d0\u4f9b\u56fe\u7247\u7684\u6587\u4ef6\u5939\u8def\u5f84\u586b\u5165\u8def\u5f84\u8f93\u5165\u6846\uff0c\u7a0b\u5e8f\u4f1a\u6309\u6b64\u8def\u5f84\u904d\u5386\u6240\u6709\u6587\u4ef6\uff0c\n    '       \u5e76\u81ea\u52a8\u628a\u6587\u4ef6\u63d2\u5165cordraw\u6587\u4ef6\u7684\u9875\u9762\u4e2d(\u81ea\u52a8\u5c45\u4e2d\u5e76\u8f6c\u6210cmyk)\n    '--------------------------------------------------------------\n    '\u7f16\u7a0b\u5b9e\u73b0\uff1aliwenhui   \u65e5\u671f\uff1a2022-07-02\n    '===================================================================\n\n    '\u83b7\u53d6\u5f53\u524d\u6587\u4ef6\u5939\u6240\u6709\u6587\u4ef6\n    Dim sPath As String\n\n    '\u6bcf\u6b21\u8fd0\u884c\u65f6\u8def\u5f84\u8f93\u5165\u6846\uff1a\n    sPath = InputBox(\"\u8bf7\u8f93\u5165\u4e00\u4e2a\u5305\u542b\u5bfc\u5165\u56fe\u7247\u7684\u6587\u4ef6\u5939\u7684\u8def\u5f84\" &amp; Chr(10) &amp; \"\u987b\u7edd\u5bf9\u8def\u5f84:(\u4f8b: E:\\vbCode)\", \"\u8f93\u5165\u8def\u5f84\")\n\n    '\u8def\u5f84\u8f93\u5165\u6846\u60c5\u51b5\u5224\u65ad\n    If StrPtr(sPath) &lt;> 0 Then\n        If Len(Trim(sPath)) > 0 Then\n            GoTo StartMacro\n        Else\n            MsgBox \"&#91;\u5b8f\u9000\u51fa\u63d0\u793a]:\" &amp; Chr(10) &amp; \"    \u4f60\u6ca1\u6709\u8f93\u5165\u4efb\u4f55\u5185\u5bb9!\"\n            Exit Sub\n        end If\n    Else\n        MsgBox \"&#91;\u5b8f\u9000\u51fa\u63d0\u793a]:\" &amp; Chr(10) &amp; \"    \u4f60\u53d6\u6d88\u5e76\u653e\u5f03\u8f93\u5165!\"\n        Exit Sub\n    end If\n\nStartMacro:\n    If PathExists(sPath) Then\n        Folder = sPath &amp; \"\\*.*\"\n        FileName = Dir(Folder)\n        While FileName &lt;> \"\"\n            '\u8c03\u7528\u8fc7\u7a0b----\u81ea\u52a8\u5bfc\u5165\u4e0a\u9762\u8def\u5f84\u4e2d\u6240\u6709\u56fe\u7247\u5230coreldraw\u6bcf\u4e2a\u9875\u9762\u4e2d\n            Call autoPicToPage(sPath &amp; \"\\\" &amp; FileName)\n            FileName = Dir\n        Wend\n        MsgBox \"\u6587\u4ef6\u81ea\u52a8\u5bfc\u5165\u6210\u529f\u3002\", vbYes, \"\u6210\u529f\u63d0\u793a\"\n    Else\n        MsgBox \"\u6307\u5b9a\u7684\u6587\u4ef6\u5939\u4e0d\u5b58\u5728\uff01\u5b8f\u5df2\u7ed3\u675f\u8fd0\u884c\"\n    End If\nEnd Sub\n\nSub autoPicToPage(sPath As String)\n    '\u5bfc\u5165\u56fe\u7247\n    ActiveLayer.Import sPath\n    \n    ' \u8bbe\u7f6e\u5f53\u524d\u56fe\u7247\u6210A4\u5927\u5c0f\n    ActiveDocument.ReferencePoint = cdrCenter\n    ActivePage.Shapes.All.CreateSelection\n    ActiveSelection.SetSize 8.267717, 11.692913\n    \n    ' \u9875\u9762\u5c45\u4e2d\n    Dim OrigSelection As ShapeRange\n    Set OrigSelection = ActiveSelectionRange\n    OrigSelection.AlignAndDistribute 3, 3, 2, 0, False, 2\n    \n    '\u8fd9\u6bb5\u4ee3\u7801\u7528\u6765\u904d\u5386\u5f53\u524d\u9875\u9762\u6240\u6709\u7684\u4f4d\u56fe\n    '\u5224\u65ad\u5176\u989c\u8272\u6a21\u5f0f\uff0c\u5982\u679c\u4e0d\u662fCMYK\u989c\u8272\u6a21\u5f0f\u7684\u56fe\u50cf\uff0c\u5219\u5c06\u5176\u8f6c\u6362\u4e3aCMYK\u6a21\u5f0f\u7684\u56fe\u50cf\u3002\n    ' \u58f0\u660e\u5f62\u72b6\u53d8\u91cf\n    Dim s As Shape\n    ' \u904d\u5386\u5f53\u524d\u9875\u9762\u6240\u6709\u7684\u4f4d\u56fe\uff08\u5982\u679c\u8981\u6269\u5927\u6216\u8005\u7f29\u5c0f\u641c\u7d22\u8303\u56f4\uff0c\u8bf7\u66ff\u6362\u6389ActivePage\uff09\n    For Each s In ActivePage.Shapes.FindShapes(, cdrBitmapShape)\n        ' \u5982\u679c\u5f53\u524d\u4f4d\u56fe\u4e0d\u662fCMYK\u989c\u8272\u6a21\u5f0f\n        If s.Bitmap.Mode &lt;> cdrCMYKColorImage Then\n        ' \u5c06\u5176\u8f6c\u6362\u4e3aCMYK\u989c\u8272\u6a21\u5f0f\n        s.Bitmap.ConvertTo cdrCMYKColorImage\n        End If\n    Next s\n    \n    ' \u6dfb\u52a0\u4e00\u4e2a\u9875\u9762\n    Dim p1 As Page\n    Set p1 = ActiveDocument.InsertPagesEx(1, False, ActivePage.Index, 8.267717, 11.692913)\nEnd Sub\n\nPublic Function PathExists(strFull) As Boolean\n    '\/\/ add declarations\n    On Error GoTo EarlyExit\n    If Not Dir(strFull, vbDirectory) = vbNullString Then PathExists = True\nEarlyExit:\n    '\/\/ add error handling\n    On Error GoTo 0\nEnd Function\n\n <\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u529f\u80fd\u8bf4\u660e\uff1a<\/strong><br>         \u4f7f\u7528\u8005\u63d0\u4f9b\u56fe\u7247\u7684\u6587\u4ef6\u5939\u8def\u5f84\u586b\u5165\u8def\u5f84\u8f93\u5165\u6846\uff0c\u7a0b\u5e8f\u4f1a\u6309\u6b64\u8def\u5f84\u904d\u5386\u6240\u6709\u6587\u4ef6\uff0c<br>         \u5e76\u81ea\u52a8\u628a\u6587\u4ef6\u63d2\u5165cordraw\u6587\u4ef6\u7684\u9875\u9762\u4e2d(\u81ea\u52a8\u5c45\u4e2d\u5e76\u8f6c\u6210cmyk)<\/h4>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"519\" src=\"https:\/\/huiyu1688.top\/wp-content\/uploads\/2022\/07\/444-1024x519.png\" alt=\"\" class=\"wp-image-820\" srcset=\"https:\/\/hy68.top\/wp-content\/uploads\/2022\/07\/444-1024x519.png 1024w, https:\/\/hy68.top\/wp-content\/uploads\/2022\/07\/444-300x152.png 300w, https:\/\/hy68.top\/wp-content\/uploads\/2022\/07\/444-768x389.png 768w, https:\/\/hy68.top\/wp-content\/uploads\/2022\/07\/444-1536x778.png 1536w, https:\/\/hy68.top\/wp-content\/uploads\/2022\/07\/444.png 1553w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h4 class=\"has-text-align-center wp-block-heading\">&lt;&lt;&lt;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;\u64cd\u4f5c\u89c6\u9891\uff1a&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;>>><\/h4>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/huiyu1688.top\/wp-content\/uploads\/2022\/07\/kk-2022-07-19-17-49-04.mp4\"><\/video><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u529f\u80fd\u8bf4\u660e\uff1a \u4f7f\u7528\u8005\u63d0\u4f9b\u56fe\u7247\u7684\u6587\u4ef6\u5939\u8def\u5f84\u586b\u5165\u8def\u5f84\u8f93\u5165\u6846\uff0c\u7a0b\u5e8f\u4f1a\u6309\u6b64\u8def\u5f84\u904d\u5386\u6240\u6709\u6587\u4ef6\uff0c \u5e76\u81ea\u52a8\u628a\u6587\u4ef6\u63d2\u5165cordr&hellip;<\/p>\n","protected":false},"author":1,"featured_media":822,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,2,8,7,6],"tags":[103],"_links":{"self":[{"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/posts\/819"}],"collection":[{"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/comments?post=819"}],"version-history":[{"count":1,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/posts\/819\/revisions"}],"predecessor-version":[{"id":823,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/posts\/819\/revisions\/823"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/media\/822"}],"wp:attachment":[{"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/media?parent=819"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/categories?post=819"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/tags?post=819"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}