2017-01-01 60 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