简体   繁体   中英

How to display Hindi Characters in rdlc report viewer in winform c#

Please provide me the solution for this issue.

I have saved record in sql with hindi language, but when i display in rdlc report viewer it shows as a boxes.

  1. SQL Database - I have saved record in hindi.

在此处输入图像描述

  1. Service Code

     public class PaperRptModel { public string Subject { get; set; } public string Course { get; set; } public string Time { get; set; } public int MaxMarks { get; set; } public int PassMarks { get; set; } readonly PaperGenEntities paperGenEntities = new PaperGenEntities(); public IList GetSingle(int Id) { List<PaperRptModel> paperRpts = new List<PaperRptModel>(); PaperRptModel model = new PaperRptModel(); var paper = paperGenEntities.Papers.FirstOrDefault(o => o.Id == Id); var subject = paperGenEntities.Subjects.FirstOrDefault(o => o.Id == paper.Subject); model.Course = $"{subject.EnglishCourse} ({subject.HindiCourse})"; model.Subject = $"{subject.EnglishName} ({subject.HindiName})"; ; model.Time = paper.MaxTime; model.MaxMarks = paper.TotalMarks?? 0; model.PassMarks = paper.PassMarks?? 0; paperRpts.Add(model); return paperRpts; } public IList GetQuestions(int Id) { List<Question> questions = new List<Question>(); Question model = new Question(); var question = paperGenEntities.Questions.FirstOrDefault(o => o.Subject == Id); model.EnglishName = question.EnglishName; model.HindiName = question.HindiName; model.DisplayMarks = question.DisplayMarks; questions.Add(model); return questions; }
  2. Window Form Code

     public partial class Form2: Form { public Form2() { InitializeComponent(); } private void Form2_Load(object sender, EventArgs e) { this.reportViewer1.LocalReport.DataSources.Clear(); var rptModel = new PaperRptModel(); var Model = rptModel.GetSingle(1); var rds1 = new ReportDataSource("DataSet1", Model); this.reportViewer1.LocalReport.DataSources.Add(rds1); var question = new Question(); var questions = rptModel.GetQuestions(1); var rds2 = new ReportDataSource("DataSet2", questions); this.reportViewer1.LocalReport.DataSources.Add(rds2); this.reportViewer1.RefreshReport(); } }
  3. Result as boxes在此处输入图像描述

If you running this in a windows client

check whether you have installed the Hindi language

在此处输入图像描述 (windows 10)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM