在StimulReports.Net报表条形码中使用国家标志

作者:mayz    来源:慧都控件网    浏览:Loading...      日期:2012-10-22

问题描述:

在StimulReports.Net报表条形码中使用国家标志

问题解答:

直接用8-bit编码.NET不是很方便,所以我们使用以下方法发送数据到条形码中,输入的条形码是一个Unicode字符串,这个字符串包含已经准备好的数据,然后条形码字符串被转换成一个字节数组,每个字符用(字节)st[index]命令 。
因此,我们有以下选项:
- Latin: pass string as is.

- bytes: convert to string, convert each byte of the command (char) byteArray [index].

- national characters: convert to the desired 8-bit code page, and then as a bytes array.
一个函数例子是将数据转换到需要的代码页面(您可以在报表设计器代码标签中插入一个报表):
[C#]

public string ToCodePage1251(string st)
{
  byte[] bt = System.Text.Encoding.GetEncoding(1251).GetBytes(st);
  System.Text.StringBuilder sb = new System.Text.StringBuilder();
  for (int index = 0; index < bt.Length; index++)
  {
    sb.Append((char)bt[index]);
  }
  return sb.ToString();
}

 

Tag标签:.Net报表 Stimulsoft Reports.Net 

本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:Stimulsoft中文网 [http://www.Stimulsoft.cn/]
本文地址: http://www.Stimulsoft.cn/Resources/FAQ/121.html

上一篇: 如何在StimulsoftReports.Net报表中使用EAN-128条形码和FNC1命令

下一篇: StimulReports.Net报表条形码中使用ASCII转义代码