2017-01-01 81 views
0

我试图导出MS Word文件,但是当我导出它时,由于我存储在数据库中的数据是由阿拉伯文字母,所以它的RTL,然后字母出现的分离信件,这是一块导出文件的:在RDLC中的阿拉伯语言报告asp.net mvc

enter image description here

控制器动作:

public ActionResult Report(string id) 
    { 



     LocalReport lr = new LocalReport(); 
     string path = Path.Combine(Server.MapPath("~/Report"), "Report1.rdlc");//Report1.rdlc is a tamplate exist in Report Folder. 
     if (System.IO.File.Exists(path)) 
     { 
      lr.ReportPath = path; 
     } 
     else 
     { 
      return View("Index"); 
     } 
     List<Note> cm = new List<Note>(); 

      cm = db.Notes.ToList(); 

     ReportDataSource rd = new ReportDataSource("DataSet1", cm); 
     lr.DataSources.Add(rd); 
     string reportType = id; 
     string mimeType; 
     string encoding; 
     string fileNameExtension; 



     string deviceInfo = 

     "<DeviceInfo>" + 
     " <OutputFormat>" + id + "</OutputFormat>" + 
     " <PageWidth>8.5in</PageWidth>" + 
     " <PageHeight>11in</PageHeight>" + 
     " <MarginTop>0.5in</MarginTop>" + 
     " <MarginLeft>1in</MarginLeft>" + 
     " <MarginRight>1in</MarginRight>" + 
     " <MarginBottom>0.5in</MarginBottom>" + 
     "</DeviceInfo>"; 

     Warning[] warnings; 
     string[] streams; 
     byte[] renderedBytes; 

     renderedBytes = lr.Render(
      reportType, 
      deviceInfo, 
      out mimeType, 
      out encoding, 
      out fileNameExtension, 
      out streams, 
      out warnings); 


     return File(renderedBytes, mimeType); 
    } 

当我出口的文件为PDF,XLSX,和PNG扩展,他们正常工作。 有人告诉我,问题可能与UTF-8有关,是否有可能?

有何建议?

+0

:“(有没有什么资源可以帮助我吗? – askm

回答

1

最后,我找到了解决方案。

去设计报表的页面:(你想什么列,行,标签或)

  1. 选择。
  2. 转到属性。
  3. 转到本地化。
  4. 设置方向RTL。
  5. 设置语言ar-sa (您可以选择以ar开头的任何语言,例如ar-eg,ar-kw或任何您喜欢的语言)。

enter image description here