Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将word文档转换为pdf-获取表格上的空白单元格(服务器端)_C#_Asp.net_Sharepoint_Sharepoint 2013_Sharepoint 2016 - Fatal编程技术网

C# 将word文档转换为pdf-获取表格上的空白单元格(服务器端)

C# 将word文档转换为pdf-获取表格上的空白单元格(服务器端),c#,asp.net,sharepoint,sharepoint-2013,sharepoint-2016,C#,Asp.net,Sharepoint,Sharepoint 2013,Sharepoint 2016,下面的代码运行良好,它完成了任务,word->PDF 只有一个问题,当word doc有包含统一单元格的表时,当将word doc转换为pdf时,pdf显示统一单元格的组合,但内部没有值 有人知道为什么?这个问题有解决办法吗 注意:这是在服务器端转换 if (nomeDocTemplate == attachment) { web.AllowUnsafeUp

下面的代码运行良好,它完成了任务,word->PDF

只有一个问题,当word doc有包含统一单元格的表时,当将word doc转换为pdf时,pdf显示统一单元格的组合,但内部没有值

有人知道为什么?这个问题有解决办法吗

注意:这是在服务器端转换

  if (nomeDocTemplate == attachment)
                                {
                                    web.AllowUnsafeUpdates = true;
                                    string wordEdit =item2.Attachments.UrlPrefix + "Template" + item.ID + ".docx";
                                    string wordAutomationServiceName = "Word Automation Services";
                                    string filenamedest = web.Url + item.File.ServerRelativeUrl;
                                    SPFile attachmentFile = item2.Web.GetFile(wordEdit);

                                    using (MemoryStream destinationStream = new MemoryStream())
                                    {

                                        //Call the syncConverter class, passing in the name of the Word Automation Service for your Farm.                             

                                        SyncConverter sc = new SyncConverter(wordAutomationServiceName);

                                        ////Pass in your User Token or credentials under which this conversion job is executed.
                                        sc.UserToken = SPContext.Current.Site.UserToken;
                                        sc.Settings.UpdateFields = true;
                                        //Save format
                                        sc.Settings.OutputFormat = SaveFormat.PDF;


                                        ////Convert to PDF by opening the file stream, and then converting to the destination memory stream.
                                        ConversionItemInfo info = sc.Convert(attachmentFile.OpenBinaryStream(), destinationStream);

                                        var filename = Path.GetFileNameWithoutExtension(item.File.Name) + ".pdf";

                                        if (info.Succeeded)
                                        {
                                            //File conversion successful, then add the memory stream to the SharePoint list.
                                            SPFile newfile = web.Lists["Tramitar"].RootFolder.Files.Add(filename, destinationStream, true);

                                        }
                                        else if (info.Failed)
                                        {
                                            throw new Exception(info.ErrorMessage);
                                        }



                                    }

                                    //ConcatAndAddContent(anexosProcesso);

                                    return;
                                }
这是文档和pdf,为了更好地理解我遇到的问题:

字:

PDF:

在SharePoint中使用Muhimbi-PDF转换器。在SharePoint中使用Muhimbi-PDF转换器。