{"id":10008197,"date":"2023-08-30T12:01:23","date_gmt":"2023-08-30T04:01:23","guid":{"rendered":"https:\/\/blog.itmax.cn\/?p=10008197"},"modified":"2023-08-30T12:01:23","modified_gmt":"2023-08-30T04:01:23","slug":"grapecity-documents-v6-0-update-2%e5%8f%91%e5%b8%83%ef%bc%8c%e6%96%b0%e5%a2%9e%e6%94%af%e6%8c%81spreadjs%e7%9a%84-sjs%e6%96%87%e4%bb%b6%e6%a0%bc%e5%bc%8f","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10008197","title":{"rendered":"GrapeCity Documents V6.0 Update 2\u53d1\u5e03\uff0c\u65b0\u589e\u652f\u6301SpreadJS\u7684.sjs\u6587\u4ef6\u683c\u5f0f"},"content":{"rendered":"<p>\u8fd1\u65e5\uff0cGrapeCity Documents \u6b63\u5f0f\u8fce\u6765\u5176V6.2 \u7684\u53d1\u5e03\u66f4\u65b0\uff0c\u80fd\u591f\u652f\u6301 SpreadJS \u4e2d .sjs \u7c7b\u578b\u7684\u6587\u4ef6\u3002\u8fd9\u4e00\u91cd\u5927\u66f4\u65b0\u5c06\u4e3a\u7528\u6237\u5e26\u6765\u66f4\u591a\u5730\u60ca\u559c\u3002<\/p>\n<p>.sjs\u6587\u4ef6\u6709\u4e24\u4e2a\u5173\u952e\u4f18\u52bf\uff1a\u7a7a\u95f4\u66f4\u5c0f\u4e14\u5bfc\u5165\u5bfc\u51fa\u901f\u5ea6\u66f4\u5feb\u3002\u901a\u8fc7\u91c7\u7528 .sjs\u683c\u5f0f\uff0cGcExcel\u5b9e\u73b0\u4e86\u66f4\u9ad8\u6548\u7684\u6587\u4ef6\u538b\u7f29\uff0c\u4ece\u800c\u4f7f\u6587\u4ef6\u5927\u5c0f\u5927\u5e45\u51cf\u5c0f\u3002\u8fd9\u4e0d\u4ec5\u8282\u7701\u4e86\u5b58\u50a8\u7a7a\u95f4\uff0c\u8fd8\u65b9\u4fbf\u4e86\u6587\u4ef6\u7684\u4f20\u8f93\u548c\u5171\u4eab\u3002\u6b64\u5916\uff0cGcExcel\u8fd8\u9488\u5bf9 .sjs\u6587\u4ef6\u8fdb\u884c\u4e86\u4f18\u5316\uff0c\u4f7f\u5176\u5728\u5bfc\u5165\u548c\u5bfc\u51fa\u8fc7\u7a0b\u4e2d\u7684\u901f\u5ea6\u5f97\u5230\u663e\u8457\u63d0\u5347\u3002<\/p>\n<p>\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd GrapeCity Documents V6.0 Update2 \u4e2d\u7684\u65b0\u7279\u6027\uff0c\u5728\u6b64\u4e4b\u524d\uff0c\u5982\u679c\u60a8\u5df2\u7ecf\u5728\u4f7f\u7528\u4e86GrapeCity Documents\u4ea7\u54c1\uff0c\u5e0c\u671b\u8fdb\u4e00\u6b65\u4e86\u89e3\u65b0\u529f\u80fd\uff0c\u53ef\u524d\u5f80\u8461\u8404\u57ce\u5b98\u7f51\u4e0b\u8f7d\u6700\u65b0\u7248\u4ea7\u54c1\u5b89\u88c5\u5305\uff0c\u4ee5\u4fbf\u8fdb\u884c\u540c\u6b65\u4f53\u9a8c\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u672c\u6b21\u53d1\u5e03\u7684\u5173\u952e\u5185\u5bb9\uff1a<\/p>\n<p>1. <strong>\u670d\u52a1\u7aef\u8868\u683c\u7ec4\u4ef6<\/strong> <a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=oJTIBL%2BPp67DJtSD4Z858A%3D%3D.yOmzJOg4L%2BpEik%2FteB3gSfXHungCzEIcnKrWTeZbCnG2PKq6gWSvuVqejPUu9fBtYmjcgyVd%2F3ibhTZ5t1I9oeTG67%2BK3lBXOn9CyOyX%2Fck%3D\" rel=\"noopener noreferrer\"><strong>GrapeCity Documents for Excel<\/strong><\/a> <strong>\u66f4\u65b0\u8bf4\u660e<\/strong><\/p>\n<p><strong>\u652f\u6301SpreadJS\u7684.sjs\u6587\u4ef6\u683c\u5f0f<\/strong><\/p>\n<p>\u5728 GcExcel \u7684 V6.0 Update 2 \u7248\u672c\u4e2d\uff0c\u589e\u52a0\u4e86\u5bf9 SpreadJS .sjs \u6587\u4ef6\u683c\u5f0f\u7684\u652f\u6301\u3002\u901a\u8fc7\u5bfc\u51fa\u4e3a .sjs \u683c\u5f0f\uff0c\u53ef\u4ee5\u5b9e\u73b0\u66f4\u77ed\u7684\u5bfc\u51fa\u65f6\u95f4\u548c\u66f4\u5c0f\u7684\u6587\u4ef6\u5c3a\u5bf8\u3002\u73b0\u5728\uff0c\u60a8\u53ef\u4ee5\u5c06 xlsx\u3001xlsm\u3001csv\u3001ssjson \u7b49\u683c\u5f0f\u7684\u6587\u4ef6\u5bfc\u51fa\u4e3a .sjs \u683c\u5f0f\uff0c\u4ee5\u4fbf\u66f4\u9ad8\u6548\u5730\u5904\u7406\u6570\u636e\u3002<\/p>\n<p>\u65b0\u7248\u672c\u589e\u5f3a\u4e86Workbook\u7c7b\u4e0a\u7684open\u548csave\u65b9\u6cd5\uff0c\u652f\u6301.sjs\u6587\u4ef6\uff0c\u5f53<strong>\u52a0\u8f7d<\/strong>\u6216<strong>\u4fdd\u5b58<\/strong>.sjs\u6587\u4ef6\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7OpenFileFormat\u548cSaveFileFormat\uff0c\u6765\u9009\u62e9Sjs\u679a\u4e3e\u9879\u3002<\/p>\n<p>\u7531\u4e8e\u5bf9.sjs\u6587\u4ef6\u683c\u5f0f\u7684\u652f\u6301\uff0c\u4f7f\u5f97\u65b0\u7248\u672c\u53ef\u4ee5\u6ee1\u8db3\u4ee5\u4e0b\u529f\u80fd\uff1a<\/p>\n<ul>\n<li>\u5feb\u901f\u5c06Excel\u6587\u4ef6\u8f6c\u6362\u4e3a.sjs\u683c\u5f0f\u3002<\/li>\n<li>\u4ee5\u66f4\u5c0f\u7684\u5360\u7528\u7a7a\u95f4\u4fdd\u5b58\u6587\u4ef6\u3002<\/li>\n<li>\u4ece.sjs\u6587\u4ef6\u4e2d\u538b\u7f29\u7684JSON\u6587\u4ef6\u751f\u6210\u5355\u4e2aJSON\u5b57\u7b26\u4e32<\/li>\n<li>\u4f7f\u5404\u79cd\u53ef\u7528\u9009\u9879\u81ea\u5b9a\u4e49SpreadJS.sjs\u6587\u4ef6\u7684\u6253\u5f00\u548c\u4fdd\u5b58<\/li>\n<\/ul>\n<p>\u9664\u6b64\u4e4b\u5916\uff0c\u670d\u52a1\u7aef\u8868\u683c\u7ec4\u4ef6\u8fd8\u65b0\u6dfb\u52a0\u4e24\u4e2a\u7c7b\uff0c<strong>SjsOpenOptions<\/strong>\u548c<strong>SjsSaveOptions<\/strong>\u3002\u5728\u5bfc\u5165\/\u5bfc\u51fa.sjs\u6587\u4ef6\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u8fd9\u4e24\u4e2a\u7c7b\u6765\u5b9a\u5236\u5305\u542b\/\u6392\u9664\u7279\u5b9a\u7684\u529f\u80fd\u3002<\/p>\n<p>\u4ee5\u4e0b\u4ee3\u7801\u7528\u4e8e\u5c55\u793a\u52a0\u8f7d SpreadJS \u7684 .sjs \u6587\u4ef6\uff0c\u5e76\u901a\u8fc7\u4f7f\u7528 SjsOpenOptions \u6392\u9664\u516c\u5f0f\u548c\u6837\u5f0f\uff0c\u7136\u540e\u4f7f\u7528 GcExcel \u6253\u5f00\u5e76\u4fdd\u5b58\u8be5\u6587\u4ef6\u7684\u8fc7\u7a0b\u3002<\/p>\n<pre><code class=\"c#\"> \/\/ \u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5de5\u4f5c\u7c3f\n Workbook workbook = new Workbook();\n InputStream stream = this.getResourceStream(&quot;sjs\/\/LoanDetails.sjs&quot;);\n\n \/\/ .sjs \u6587\u4ef6\u683c\u5f0f\u7684 OpenOptions\n SjsOpenOptions openOptions = new SjsOpenOptions();\n openOptions.setIncludeFormulas(false);\n openOptions.setIncludeStyles(false);\n\n \/\/ GcExcel \u652f\u6301\u4f7f\u7528 OpenOptions \u6253\u5f00 .sjs \u6587\u4ef6\u683c\u5f0f\n workbook.open(stream, openOptions);\n\n \/\/ \u4fdd\u5b58\u4e3a .sjs \u6587\u4ef6\n workbook.save(&quot;OpenSjsWithOpenOptions.sjs&quot;);<\/code><\/pre>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044163589\" alt=\"\" title=\"\"><br \/><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044163590\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p><strong>\u5f62\u72b6\u6587\u672c\u7684\u5bf9\u9f50\u9009\u9879<\/strong><\/p>\n<p>GcExcel\u5728ITextRange\u63a5\u53e3\u4e2d\u6dfb\u52a0\u4e86\u65b0\u7684TextAlignment\u5c5e\u6027\uff0c\u7528\u4e8e\u83b7\u53d6\u6216\u8bbe\u7f6e\u5f62\u72b6\u4e2d\u6587\u672c\u8303\u56f4\u6216\u6bb5\u843d\u7684\u5bf9\u9f50\u65b9\u5f0f\u3002\u8be5\u5c5e\u6027\u53ef\u4ee5\u7ed9\u6587\u672c\u8bbe\u7f6e\u5bf9\u9f50\u65b9\u5f0f\uff0c\u5982\u5de6\u5bf9\u9f50\u3001\u53f3\u5bf9\u9f50\u3001\u5c45\u4e2d\u3001\u5206\u6563\u548c\u4e24\u7aef\u5bf9\u9f50\u3002\u5728\u9700\u8981\u6309\u7167UI\u8bbe\u8ba1\u89c4\u5219\u6216\u6309\u7167\u6570\u636e\u683c\u5f0f\u5bf9\u9f50\u6587\u672c\uff08\u4f8b\u5982\u5c06\u6587\u672c\u5de6\u5bf9\u9f50\u6216\u5c06\u6570\u5b57\u53f3\u5bf9\u9f50\uff09\u7684\u573a\u666f\u4e2d\u975e\u5e38\u6709\u5e2e\u52a9\u3002<\/p>\n<p>\u4ee5\u4e0b\u4ee3\u7801\u7528\u4e8e\u5c55\u793a\u5c06\u5f62\u72b6\u4e2d\u591a\u4e2a\u6bb5\u843d\u7684\u5bf9\u9f50\u65b9\u5f0f\u8bbe\u7f6e\u4e3a\u5c45\u4e2d\u548c\u5de6\u5bf9\u9f50\uff1a<\/p>\n<pre><code class=\"c#\"> IShape shape = worksheet.Shapes.AddShape(AutoShapeType.RoundedRectangle, (double)10, (double)10, (double)320, (double)150);\n shape.TextFrame.TextRange.TextAlignment = TextAlignmentAnchor.Left;\n shape.TextFrame.TextRange.Font.Name = &quot;Calibri&quot;;\n shape.TextFrame.TextRange.Font.Size = 16;\n shape.TextFrame.TextRange.Font.Color.RGB = Color.Black;\n shape.TextFrame.TextRange.Font.Underline = TextUnderlineType.None;\n\n shape.TextFrame.TextRange.Paragraphs.Add(&quot;Quarterly Results&quot;);\n shape.TextFrame.TextRange.Paragraphs[0].TextAlignment = TextAlignmentAnchor.Center;\n shape.TextFrame.TextRange.Paragraphs[0].Font.Size = 28;\n shape.TextFrame.TextRange.Paragraphs[0].Font.Underline = TextUnderlineType.Single;\n shape.TextFrame.TextRange.Paragraphs.Add(&quot;&quot;);\n\n shape.TextFrame.TextRange.Paragraphs.Add(&quot;Business Domain: E-Commerce&quot;);\n shape.TextFrame.TextRange.Paragraphs[2].TextAlignment = TextAlignmentAnchor.Left;\n\n shape.TextFrame.TextRange.Paragraphs.Add(&quot;Quarter: Q4&quot;);\n shape.TextFrame.TextRange.Paragraphs[3].TextAlignment = TextAlignmentAnchor.Left;<\/code><\/pre>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044163591\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p><strong>\u5728\u5f62\u72b6\u548c\u56fe\u8868\u4e2d\u8bbe\u7f6e\u5782\u76f4\u6587\u672c\u65b9\u5411<\/strong><\/p>\n<p>\u5728\u67d0\u4e9b\u6587\u6863\u5e94\u7528\u4e2d\uff0c\u4f7f\u7528\u8005\u5e0c\u671b\u5c06\u6587\u672c\u65b9\u5411\u8bbe\u7f6e\u4e3a\u5782\u76f4\u65b9\u5411\u3002GcExcel\u5728\u5f62\u72b6\u548c\u56fe\u8868\u7684API\u4e2d\u6dfb\u52a0\u4e86Direction\u5c5e\u6027\uff1a<\/p>\n<ul>\n<li>IShape.TextFrame.Direction\uff1a\u7528\u4e8e\u5f62\u72b6\u7684\u6587\u672c\u65b9\u5411\u3002<\/li>\n<li>ITickLabels.Direction\uff1a\u7528\u4e8e\u56fe\u8868\u8f74\u4e0a\u523b\u5ea6\u6807\u7b7e\u7684\u6587\u672c\u65b9\u5411\u3002<\/li>\n<li>IChartTitle.Direction \u6216 IChartTitle.TextFrame.Direction\uff1a\u7528\u4e8e\u56fe\u8868\u6807\u9898\u7684\u6587\u672c\u65b9\u5411\u3002<\/li>\n<li>IAxisTitle.Direction \u6216 IAxisTitle.TextFrame.Direction\uff1a\u7528\u4e8e\u5750\u6807\u8f74\u6807\u9898\u7684\u6587\u672c\u65b9\u5411\u3002<\/li>\n<li>IDataLabels.Direction\uff1a\u7528\u4e8e\u6307\u5b9a\u7cfb\u5217\u6570\u636e\u6807\u7b7e\u7684\u6587\u672c\u65b9\u5411\u3002<\/li>\n<li>IDataLabel.Direction \u6216 IDataLabel.TextFrame.Direction\uff1a\u7528\u4e8e\u56fe\u8868\u6570\u636e\u70b9\u4e0a\u6570\u636e\u6807\u7b7e\u7684\u6587\u672c\u65b9\u5411\u3002<\/li>\n<\/ul>\n<p>Direction\u5c5e\u6027\u63a5\u53d7TextDirection\u679a\u4e3e\u9009\u9879\uff0c\u53ef\u8bbe\u7f6e\u6587\u672c\u5728\u4ee5\u4e0b\u65b9\u5411\u4e0a\u7684\u65b9\u5411\uff1a<\/p>\n<ul>\n<li>TextDirection.Horizontal\uff1a\u8868\u793a\u6587\u672c\u6c34\u5e73\u663e\u793a\u3002<\/li>\n<li>TextDirection.Vertical\uff1a\u8868\u793a\u6587\u672c\u5782\u76f4\u663e\u793a\u3002<\/li>\n<li>TextDirection.Rotate90\uff1a\u8868\u793a\u6587\u672c\u5c06\u65cb\u8f6c90\u5ea6\u3002<\/li>\n<li>TextDirection.Rotate270\uff1a\u8868\u793a\u6587\u672c\u5c06\u65cb\u8f6c270\u5ea6\u3002<\/li>\n<li>TextDirection.Stacked\uff1a\u8868\u793a\u6587\u672c\u5c06\u5806\u53e0\u663e\u793a\uff0c\u8bfb\u53d6\u987a\u5e8f\u4ece\u5de6\u5230\u53f3\u3002<\/li>\n<li>TextDirection.StackedRtl\uff1a\u8868\u793a\u6587\u672c\u5c06\u5806\u53e0\u663e\u793a\uff0c\u8bfb\u53d6\u987a\u5e8f\u4ece\u53f3\u5230\u5de6\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0b\u4ee3\u7801\u7528\u4ee5\u5c06\u6587\u672c\u7684TextDirection\u8bbe\u7f6e\u4e3aStacked\u65b9\u5411\uff1a<\/p>\n<pre><code class=\"C#\">var shape = worksheet.Shapes.AddShape(AutoShapeType.Rectangle, worksheet.Range[&quot;C2:F12&quot;]);\n shape.TextFrame.TextRange.Add(&quot;\u6b22\u8fce\u6765\u5230\u8461\u8404\u57ce&quot;);\n\n \/\/\u5c06\u6587\u672c\u65b9\u5411\u8bbe\u7f6e\u4e3a\u5806\u53e0\uff0c\u5e76\u4e14\u6587\u672c\u7684\u9605\u8bfb\u987a\u5e8f\u4ece\u5de6\u5230\u53f3\u3002\n shape.TextFrame.Direction = TextDirection.Stacked;<\/code><\/pre>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044163592\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p><strong>\u652f\u6301\u53cc\u9762\u6253\u5370 &#8211; \u8be5\u7279\u6027\u4ec5\u9002\u7528\u4e8e.NET\u7248\u672c<\/strong><\/p>\n<p>\u6709\u65f6\u5019\u4f7f\u7528\u8005\u9700\u8981\u5728\u4e00\u9875\u7684\u4e24\u9762\u6253\u5370\u4e00\u4e2a\u5305\u542b\u957f\u5de5\u4f5c\u8868\u7684\u5de5\u4f5c\u7c3f\u3002GcExcel .NET\u63d0\u4f9b\u4e86PrintOutOptions\u7c7b\u4e2d\u7684Duplex\u679a\u4e3e\u6765\u542f\u7528\/\u7981\u7528\u9875\u9762\u4e0a\u7684\u53cc\u9762\u6253\u5370\u3002\u8be5\u679a\u4e3e\u5171\u6709\u56db\u4e2a\u9009\u9879\uff0c\u7528\u6237\u53ef\u4ee5\u6839\u636e\u9700\u8981\u9009\u62e9\u6253\u5370\u5de5\u4f5c\u7c3f\u7684\u65b9\u5f0f\uff1a<\/p>\n<p>Duplex.Default\uff1a\u8868\u793a\u6253\u5370\u673a\u7684\u9ed8\u8ba4\u53cc\u9762\u6253\u5370\u8bbe\u7f6e\u3002<\/p>\n<p>Duplex.Simplex\uff1a\u8868\u793a\u5355\u9762\u6253\u5370\u3002<\/p>\n<p>Duplex.Vertical\uff1a \u8868\u793a\u53cc\u9762\u5782\u76f4\u6253\u5370\u3002<\/p>\n<p>Duplex.Horizontal\uff1a \u8868\u793a\u53cc\u9762\u6c34\u5e73\u6253\u5370\u3002<\/p>\n<p>\u4ee5\u4e0b\u4ee3\u7801\u7528\u4e8e \u5c55\u793a\u5c06\u4ee5\u53cc\u9762\u5782\u76f4\u6253\u5370\u65b9\u5f0f\u6253\u5370\u4e09\u4efd\u5de5\u4f5c\u7c3f\u526f\u672c\u3002<\/p>\n<pre><code class=\"c#\">\/\/ \u521b\u5efa\u6253\u5370\u9009\u9879\u3002\n PrintOutOptions options = new PrintOutOptions();\n \/\/ \u8bbe\u7f6e\u6253\u5370\u7684\u6253\u5370\u673a\u540d\u79f0\u4e3a &quot;Printer&quot;\u3002\n options.ActivePrinter = &quot;Printer&quot;;\n \/\/ \u6253\u53703\u4efd\u526f\u672c\u3002\n options.Copies = 3;\n \/\/ \u8bbe\u7f6e\u53cc\u9762\u5782\u76f4\u6253\u5370\u3002\n options.Duplex = System.Drawing.Printing.Duplex.Vertical;\n \/\/ \u4f7f\u7528 &quot;Printer&quot; \u6253\u5370\u6b64\u5de5\u4f5c\u7c3f\u3002\n workbook.PrintOut(options);<\/code><\/pre>\n<p>2. <strong>\u670d\u52a1\u7aef PDF \u7ec4\u4ef6<\/strong> <a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=C%2BabnhiKlIT9XLahUDgYZA%3D%3D.Rxjn3DRuksgZ%2B8abk4GxiOd8Ejbfrqr%2BxnQws%2F8idMxQn%2BJT%2FcLLJ8BLvW53OzARDW5Rd%2B4C9Ono6H81vqrlxw%3D%3D\" rel=\"noopener noreferrer\"><strong>GrapeCity Documents for PDF<\/strong><\/a> <strong>\u66f4\u65b0\u8bf4\u660e<\/strong><\/p>\n<p><strong>\u5bf9PDF\u6587\u4ef6\u6253\u5f00\u548c\u4fdd\u5b58\u8fdb\u884c\u589e\u5f3a<\/strong><\/p>\n<p>\u5728GcExcel V6.0 Update 2 \u7248\u672c\u4e2d\uff0cGcPdf\u5728\u5904\u7406\u7531\u5176\u4ed6\u8f6f\u4ef6\u751f\u6210\u7684\u73b0\u6709PDF\u6587\u6863\u65b9\u9762\u8fdb\u884c\u4e86\u6539\u8fdb\uff0c\u5e76\u63d0\u4f9b\u4ee5\u4e0b\u4f18\u52bf\uff1a<\/p>\n<ol>\n<li>GcPdf\u73b0\u5728\u53ef\u4ee5\u52a0\u8f7d\u548c\u4fdd\u5b58\u53ef\u80fd\u4e0d\u4e25\u683c\u7b26\u5408PDF\u89c4\u8303\u7684PDF\u6587\u6863\u3002<\/li>\n<li>GcPdf\u5c06\u4fdd\u7559\u5d4c\u5165\u5728PDF\u6587\u6863\u4e2d\u7684\u4efb\u4f55\u975ePDF\u89c4\u8303\u7684\u81ea\u5b9a\u4e49\u6570\u636e\u3002<\/li>\n<li>\u52a0\u8f7dPDF\u6587\u6863\u7684\u5e73\u5747\u901f\u5ea6\u5f97\u5230\u4e86\u6539\u5584\u3002<\/li>\n<\/ol>\n<p>\u8fd9\u4e9b\u6539\u8fdb\u4f7f\u5f97GcPdf\u80fd\u591f\u66f4\u597d\u5730\u5904\u7406\u5404\u79cdPDF\u6587\u6863\uff0c\u5373\u4f7f\u8fd9\u4e9b\u6587\u6863\u4e0d\u662f\u5b8c\u5168\u7b26\u5408PDF\u89c4\u8303\u6216\u5305\u542b\u4e00\u4e9b\u975e\u6807\u51c6\u7684\u6570\u636e\u3002\u540c\u65f6\uff0c\u52a0\u8f7dPDF\u6587\u6863\u7684\u901f\u5ea6\u4e5f\u5f97\u5230\u4e86\u63d0\u5347\u3002<\/p>\n<p><strong>\u5728\u5bc6\u7801\u672a\u77e5\u7684\u60c5\u51b5\u4e0b\u5904\u7406\u53d7\u5bc6\u7801\u4fdd\u62a4\u7684\u6587\u4ef6<\/strong><\/p>\n<p>GcPdf\u5141\u8bb8\u5728\u4e0d\u6307\u5b9a\u5bc6\u7801\u7684\u60c5\u51b5\u4e0b\u5904\u7406\u53d7\u5bc6\u7801\u4fdd\u62a4\u7684\u6587\u4ef6\u3002\u5728\u52a0\u8f7d\u53d7\u5bc6\u7801\u4fdd\u62a4\u7684\u6587\u4ef6\u540e\uff0c\u60a8\u53ef\u4ee5\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c\u800c\u65e0\u9700\u6307\u5b9a\u5bc6\u7801\uff1a<\/p>\n<ul>\n<li>\u8bfb\u53d6\/\u5199\u5165\u4e0d\u57fa\u4e8ePDF\u5b57\u7b26\u4e32\u5bf9\u8c61\u7684\u5c5e\u6027\uff0c\u4f8b\u5982\uff1a<\/li>\n<li>\u60a8\u53ef\u4ee5\u83b7\u53d6\/\u8bbe\u7f6eCheckBoxField\u6216RadioButtonField\u7684\u503c\u3002<\/li>\n<li>\u83b7\u53d6\u67d0\u4e2a\u6587\u6863\u7684\u7279\u5b9a\u7edf\u8ba1\u4fe1\u606f\uff0c\u4f8b\u5982\u83b7\u53d6\u9875\u9762\u6570\u3001\u6ce8\u91ca\u6570\u7b49\u3002<\/li>\n<li>\u83b7\u53d6\u6216\u66f4\u6539\u6587\u6863\u5143\u6570\u636e\uff0c\u56e0\u4e3a\u5143\u6570\u636e\u901a\u5e38\u672a\u52a0\u5bc6\u3002<\/li>\n<li>\u66f4\u6539\u67d0\u4e9b\u7c7b\u578b\u5b57\u6bb5\u7684\u503c\uff1aCheckBoxField\u3001RadioButtonField\uff1b\u53ef\u4ee5\u66f4\u6539TextBoxField\u3001CombTextField\u7684\u503c\uff0c\u4f46\u6709\u4e00\u4e9b\u9650\u5236\u3002<\/li>\n<li>\u5982\u679c\u53ef\u4ee5\u5728\u4e0d\u4f7f\u7528PDF\u5b57\u7b26\u4e32\u7684\u60c5\u51b5\u4e0b\u5b9a\u4e49\u65b0\u5bf9\u8c61\uff0c\u60a8\u53ef\u4ee5\u6dfb\u52a0\u8be5\u5bf9\u8c61\u3002\u4f8b\u5982\uff0c\u60a8\u53ef\u4ee5\u5411\u4e00\u4e2a\u9875\u9762\u6216\u6240\u6709\u9875\u9762\u6dfb\u52a0\u4e00\u4e2aSquareAnnotation\u3002<\/li>\n<\/ul>\n<p>\u65b0\u589e\u4e86DecryptionOptions\u7c7b\u6765\u8868\u793a\u89e3\u5bc6\u9009\u9879\u3002\u5f53\u52a0\u8f7d\u52a0\u5bc6\u7684PDF\u65f6\uff0c\u60a8\u53ef\u4ee5\u5c06\u5176\u4f5c\u4e3a\uff08\u53ef\u9009\uff09\u53c2\u6570\u4f20\u9012\u7ed9GcPdfDocument.Load()\u65b9\u6cd5\u3002\u901a\u8fc7\u5c06DecryptionOptions.ThrowExceptionIfInvalidPassword\u8bbe\u7f6e\u4e3afalse\uff08\u9ed8\u8ba4\u4e3atrue\uff09\uff0c\u4ee5\u5141\u8bb8\u52a0\u8f7d\u53d7\u5bc6\u7801\u4fdd\u62a4\u7684PDF\u800c\u65e0\u9700\u6307\u5b9a\u5176\u5bc6\u7801\u3002\u53e6\u4e00\u4e2a\u76f8\u5173\u7684\u6807\u5fd7\u662fDecryptionOptions.ThrowExceptionIfUnsupportedSecurityOptions\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e5f\u4e3atrue\u3002\u5c06\u5176\u8bbe\u7f6e\u4e3afalse\u53ef\u4ee5\u5141\u8bb8GcPdf\u52a0\u8f7d\u5177\u6709\u672a\u77e5\u6216\u635f\u574f\u7684\u5b89\u5168\u5904\u7406\u7a0b\u5e8f\u7684\u6587\u6863\u3002<\/p>\n<p>\u4ee5\u4e0b\u4ee3\u7801\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u5411\u53d7\u5bc6\u7801\u4fdd\u62a4\u7684PDF\u6dfb\u52a0\u6ce8\u91ca\uff0c\u800c\u65e0\u9700\u6307\u5b9a\u5bc6\u7801\uff1a<\/p>\n<pre><code class=\"c#\">using var fs = File.OpenRead(&quot;financial-report.pdf&quot;);\n var doc = new GcPdfDocument();\n doc.Load(fs, new DecryptionOptions() { ThrowExceptionIfInvalidPassword = false, ThrowExceptionIfUnsupportedSecurityOptions = false });\n \/\/ \u83b7\u53d6\u7b2c\u4e00\u9875\u7684\u5c3a\u5bf8\uff1a\n var page = doc.Pages[0];\n var pageSize = page.Size;\n \/\/ \u6dfb\u52a0\u4e00\u4e2a\u65b9\u5f62\u6ce8\u91ca\uff1a\n SquareAnnotation sa = new SquareAnnotation();\n sa.Page = page;\n sa.Rect = new RectangleF(10, 10, pageSize.Width - 20, pageSize.Height - 20);\n sa.Color = Color.Red;\n doc.Save(&quot;AnnotationAdded.pdf&quot;);<\/code><\/pre>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044163593\" alt=\"\" title=\"\" loading=\"lazy\"><br \/><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044163594\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>3. <strong>\u670d\u52a1\u7aef Word \u7ec4\u4ef6<\/strong> <a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=NGQwZ1UYmfHZMV3Ea%2Fkv9w%3D%3D.LywuL%2Fxolt%2FHMDIlK57CyzFfFJ%2FNeYwyNfc%2BG7TDy7ZLb8f2f43sosTMFQLCRjip4Tq%2FwvbPkj0ZqEm5zxTbzw%3D%3D\" rel=\"noopener noreferrer\"><strong>GrapeCity Documents for Word<\/strong><\/a> <strong>\u66f4\u65b0\u8bf4\u660e<\/strong><\/p>\n<p><strong>\u5bf9\u4e8eOffice Math\u51fd\u6570\u548c\u8f6c\u6362\u4e3aMathML\u7684\u652f\u6301<\/strong><\/p>\n<p>\u5728\u65b0\u7248\u672c\u4e2d\uff0cGcWord\u652f\u6301\u5728Word\u6587\u6863\u4e2d\u521b\u5efa\u548c\u7f16\u8f91Office Math\u5185\u5bb9\u3002GcWord\u4e2d\u7684OMath\u652f\u6301\u5305\u62ec\u5b8c\u6574\u7684API\uff0c\u7528\u4e8e\u5904\u7406\u5728\u79d1\u5b66\u3001\u6570\u5b66\u548c\u901a\u7528\u76ee\u7684\u7684Word\u6587\u6863\u4e2d\u5e7f\u6cdb\u4f7f\u7528\u7684\u6570\u5b66\u7b26\u53f7\u3001\u516c\u5f0f\u548c\u65b9\u7a0b\u3002\u4ee5\u4e0b\u662fOMath\u652f\u6301\u5f15\u5165\u7684\u65b0API\u7684\u4e3b\u8981\u4eae\u70b9\uff1a<\/p>\n<ul>\n<li>\u7528\u4e8e\u8868\u793aGcWord\u4e2d\u7684Office Math\u5185\u5bb9\u7684\u4e24\u4e2a\u4e3b\u8981\u7c7b\u662fOMathParagraph\u548cOMath\u3002OMathParagraph\u8868\u793a\u5e26\u6709Office Math\u5185\u5bb9\u7684\u6bb5\u843d\uff0c\u800cOMath\u8868\u793a\u5185\u8054\u7684Office Math\u533a\u57df\uff0c\u53ef\u4ee5\u5305\u542b\u5728OMathParagraph\u6216\u5e38\u89c4\u6bb5\u843d\u4e2d\u3002<\/li>\n<li>\u63d0\u4f9b\u4e86\u4e13\u95e8\u7684\u7c7b\uff08\u5982OMathFunction\u3001OMathEquationArray\u3001OMathRadical\u7b49\uff09\uff0c\u7528\u4e8e\u8868\u793aOMath\u533a\u57df\u4e2d\u7684\u5404\u79cd\u6570\u5b66\u7ed3\u6784\u3002\u8fd9\u4e9b\u7c7b\u90fd\u662f\u4ece\u901a\u7528\u7684\u62bd\u8c61OMathStruct\u57fa\u7c7b\u6d3e\u751f\u800c\u6765\u3002<\/li>\n<li>\u53ef\u4ee5\u901a\u8fc7\u65b0\u7684RangeBase\u5c5e\u6027\uff08OMathParagraphs\u3001OMaths\u3001OMathStructs\u3001OMathElements\u548cOMathMatrixRows\uff09\u8bbf\u95eeOffice Math\u5185\u5bb9\u3002<\/li>\n<li>\u4e3a\u4e86\u65b9\u4fbf\u6dfb\u52a0MS Word\u652f\u6301\u7684\u5185\u7f6e\u65b9\u7a0b\uff0cRangeBase\u3001OMathParagraph\u3001OMath\u548cOMathElement\u7c7b\u4e0a\u63d0\u4f9b\u4e86\u65b9\u4fbf\u7684Add\/Insert\u65b9\u6cd5\uff0c\u63a5\u53d7\u4e00\u4e2aOMathBuiltInEquation\u679a\u4e3e\u503c\uff0c\u7528\u4e8e\u8bc6\u522b\u6240\u9700\u7684\u65b9\u7a0b\u3002<\/li>\n<li>\u5305\u542b\u4e00\u4e2a\u5b9e\u7528\u7684MathMLConverter\u7c7b\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u5728GcWord\u7684OMath\u5185\u5bb9\u548cMathML\u4e4b\u95f4\u8fdb\u884c\u8f6c\u6362\u3002<\/li>\n<\/ul>\n<p>\u6709\u5173GcWord\u4e2dOMath\u652f\u6301\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605Office Math\u6587\u6863\u3002<\/p>\n<p>\u4ee5\u4e0b\u4ee3\u7801\u7528\u4e8e\u5c55\u793a\u4f7f\u7528OMath\u7c7b\u548c\u5176\u51fd\u6570\u5c06\u4e00\u4e2a\u65b9\u7a0b\u6dfb\u52a0\u5230Word\u6587\u4ef6\u4e2d\u7684\u8fc7\u7a0b\u3002<\/p>\n<pre><code class=\"c#\">var sampleDoc = new GcWordDocument();\n var om = sampleDoc.Body.AddParagraph().AddOMathParagraph().AddOMath();\n om.AddRun(&quot;\u0393&quot;).Font.Italic = false;\n om.AddDelimiter(new string[] { &quot;z&quot; });\n om.AddRun(&quot;=&quot;);\n var nary = om.AddNary(&quot;&quot;, &quot;0&quot;, &quot;\u221e&quot;, &quot;\u222b&quot;);\n nary.Base.AddSuperscript(&quot;t&quot;, &quot;z-1&quot;);\n nary.Base.AddSuperscript(&quot;e&quot;, &quot;-t&quot;);\n nary.Base.AddRun(&quot;dt&quot;);\n om.AddRun(&quot;=&quot;);\n var frac = om.AddFraction();\n var superscript = frac.Numerator.AddSuperscript(&quot;e&quot;, &quot;-&quot;);\n superscript.Superscript.AddRun(&quot;\u03b3&quot;).Font.Bidi = true;\n superscript.Superscript.AddRun(&quot;z&quot;);\n frac.Denominator.AddRun(&quot;z&quot;);\n nary = om.AddNary(&quot;&quot;, &quot;k=1&quot;, &quot;\u221e&quot;, &quot;\u220f&quot;);\n superscript = nary.Base.AddSuperscript(&quot;&quot;, &quot;-1&quot;);\n var delimiter = superscript.Base.AddDelimiter();\n var item = delimiter.Items.Add();\n item.AddRun(&quot;1+&quot;);\n item.AddFraction(&quot;z&quot;, &quot;k&quot;, null);\n superscript = nary.Base.AddSuperscript(&quot;e&quot;, &quot;z&quot;);\n superscript.Superscript.AddRun(&quot;\/&quot;).OMathFormat.IsLiteral = true;\n superscript.Superscript.AddRun(&quot;k&quot;);\n om.AddRun(&quot;, \u03b3\u22480.577216&quot;);\n sampleDoc.Save(&quot;MathEquation.docx&quot;);\n\n<\/code><\/pre>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000044163595\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u4ee5\u4e0aGrapeCity Documents V6.2\u7684\u65b0\u7279\u6027\u4ecb\u7ecd\uff0c\u5982\u679c\u60a8\u5bf9\u4ea7\u54c1\u611f\u5174\u8da3\uff0c\u6b22\u8fce\u524d\u5f80<a target=\"_blank\" href=\"https:\/\/link.segmentfault.com\/?enc=bOd5oHBpT1Ss253nR1Rofg%3D%3D.IkmSQvOWuPy36hzsaOaD%2B65HVc%2BbnUhX79SvkvP17QqNaLt65i22qDLAmZOfcVozu5OGBKq0hlx4cI%2FCQAgApKbY8k8hEraKXJp7vEpO%2B1M%3D\" rel=\"noopener noreferrer\">\u8461\u8404\u57ce\u5b98\u7f51<\/a>\u4e0b\u8f7d\u4ea7\u54c1\u5b89\u88c5\u5305\uff0c\u540c\u6b65\u4f53\u9a8cGrapeCity Documents V6.2\u7684\u5168\u65b0\u529f\u80fd\u3002<\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000044163587\">https:\/\/segmentfault.com\/a\/1190000044163587<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd1\u65e5\uff0cGrapeCity Documents \u6b63\u5f0f\u8fce\u6765\u5176V6.2 \u7684\u53d1\u5e03\u66f4\u65b0\uff0c\u80fd\u591f\u652f\u6301 SpreadJS \u4e2d  [&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":""},"categories":[4],"tags":[],"class_list":["post-10008197","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008197","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10008197"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008197\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10008197"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10008197"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10008197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}