难如果是word就自带了一繁简转换工具。可惜excel里面没有。不知道微软的人怎么想的。呵呵

解决方案 »

  1.   

    在vb.net有个转换的方法,但只适用于文本文件,参考代码如下:
    Imports System
    Imports System.IO
    Imports System.Text
    Imports Microsoft.VisualBasic
    Class StrConv1
        Public Shared Sub Main(Args() As String)
    If (Args.Length < 2)
    Console.WriteLine("Usage Conv infilename outfilename.")
    return
    End If
    Dim OutFile, InFile As String
    InFile = Args(0)
    OutFile = Args(1)
            Dim fs As New System.IO.FileStream(InFile, IO.FileMode.Open)
            Dim sr As New System.IO.StreamReader(fs, System.Text.Encoding.GetEncoding("gb2312"))
            Dim sw As New System.IO.StreamWriter(OutFile, false, System.Text.Encoding.GetEncoding("gb2312"))
    Dim buf(1024) As Char
            Dim len As Integer = sr.Read(buf, 0, 1024)
    Dim temp As String
    While len > 0
    temp = new String(buf, 0, len)
    temp = StrConv(temp, VbStrConv.SimplifiedChinese)
    sw.Write(temp)
    len = sr.Read(buf, 0, 1024)
    End While
            sr.Close()
            sw.Close()
        End Sub
    End Class
      

  2.   

    经过测试,也可以在C#环境下用:
    using System;
    using System.IO;
    using System.Text;
    using Microsoft.VisualBasic;
    class StrConv1 {
    public static void Main(String[] Args) {
    if (Args.Length < 2) {
    Console.WriteLine("Usage Conv infilename outfilename.");
    return;
    }
    String InFile = Args[0];
    String OutFile = Args[1];
    FileStream fs = new FileStream(InFile, FileMode.Open);
    StreamReader sr = new StreamReader(fs, System.Text.Encoding.GetEncoding("gb2312"));
    StreamWriter sw = new StreamWriter(OutFile, false, System.Text.Encoding.GetEncoding("gb2312"));
    char[] buf = new char[1024];
    int len = sr.Read(buf, 0, 1024);
    String temp;
    while (len > 0) {
    temp = new String(buf, 0, len);
    temp = Strings.StrConv(temp, VbStrConv.SimplifiedChinese, 1033);
    sw.Write(temp);
    len = sr.Read(buf, 0, 1024);
    }
    sr.Close();
    sw.Close();
    }
    }但必须这样编译:
    先找到microsoft.visualbasic.dll这个文件所在的目录(和mscorlib.dll同一目录下),假设在c:\winnt\microsoft.net\framework\v1.1.4322\这个目录下,上面的程序存到文件名为yourfile.cs的文件,然后编译:
    csc /r:c:\winnt\microsoft.net\framework\v1.1.4322\microsoft.visualbasic.dll yourfile.cs运行:yourfile test.txt result.txt就可以实现了,但前提条件是必须是文本文件的格式。
      

  3.   

    在C#里面进行简体<->繁体的转换也可以利用VB6中的StrConv函数。在使用之前需要在项目中添加Microsoft  Visual  Basic  .NET  Runtime的Reference,这样才能够使用Microsoft.VisualBasic下的各种函数。  
     
    下面是一段例子代码:  
               string  str1="娱乐";  
               string  str2=Microsoft.VisualBasic.Strings.StrConv(str1,Microsoft.VisualBasic.VbStrConv.TraditionalChinese,0);  
               MessageBox.Show(str2);  
               //str2  ==  "娛樂"  
      

  4.   

    我有方法,先用DBF倒出,然后用我的一个软件转换,要得话留个MAIL
      

  5.   

    我来说利用操作系统的方法:
    既然word自带了一繁简转换工具,页excel里面没有,那么为何不直接利用word自带了一繁简转换工具?
    1.打开excel文件
    2.Ctrl+A
    3.Ctrl+C
    4.打开Word
    5.Ctrl+V
    6.调用word自带的繁简转换工具
    7.Ctrl+A
    8.Ctrl+C
    9.转到excel
    10.Ctrl+A
    11.Ctrl+V
    呵呵,C#暂时留着作别的用途吧。
      

  6.   

    楼上的使人工的,你不能每从数据库里读一条记录都要这么做一次
    同意 xixigongzhu(夕夕公主)
      

  7.   

    1. MS後來也出了一個tools使excel & powerpoint也可以繁簡互換
    2. 用程序實現: 如果是單純的excel文件(全部數據都是在cell里,沒有其它如文本框,controls)其實也可讀取excel文件後利用XiXiGongZhu,TheAres所說的文本轉換方式進行轉換
      

  8.   

    xixigongzhu(夕夕公主) 是男是女??? 怎这等厉害!!!
      

  9.   

    给你个完整的例子:(需要引用Microsoft.VisualBasic)
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;
    using Microsoft.VisualBasic;namespace gb2big
    {
    /// <summary>
    /// Form1 的摘要说明。
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    {
    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.TextBox textBox1;
    private System.Windows.Forms.TextBox textBox2;
    private System.Windows.Forms.TextBox textBox3;
    private System.Windows.Forms.Button button2;
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.Container components = null; public Form1()
    {
    //
    // Windows 窗体设计器支持所必需的
    //
    InitializeComponent(); //
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
    //
    } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if (components != null) 
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } #region Windows Form Designer generated code
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    this.button1 = new System.Windows.Forms.Button();
    this.textBox1 = new System.Windows.Forms.TextBox();
    this.textBox2 = new System.Windows.Forms.TextBox();
    this.textBox3 = new System.Windows.Forms.TextBox();
    this.button2 = new System.Windows.Forms.Button();
    this.SuspendLayout();
    // 
    // button1
    // 
    this.button1.Location = new System.Drawing.Point(200, 24);
    this.button1.Name = "button1";
    this.button1.Size = new System.Drawing.Size(56, 21);
    this.button1.TabIndex = 0;
    this.button1.Text = "gb2big";
    this.button1.Click += new System.EventHandler(this.button1_Click);
    // 
    // textBox1
    // 
    this.textBox1.Location = new System.Drawing.Point(8, 24);
    this.textBox1.Name = "textBox1";
    this.textBox1.Size = new System.Drawing.Size(184, 21);
    this.textBox1.TabIndex = 1;
    this.textBox1.Text = "";
    // 
    // textBox2
    // 
    this.textBox2.Location = new System.Drawing.Point(8, 80);
    this.textBox2.Name = "textBox2";
    this.textBox2.Size = new System.Drawing.Size(184, 21);
    this.textBox2.TabIndex = 2;
    this.textBox2.Text = "";
    // 
    // textBox3
    // 
    this.textBox3.Location = new System.Drawing.Point(8, 136);
    this.textBox3.Name = "textBox3";
    this.textBox3.Size = new System.Drawing.Size(184, 21);
    this.textBox3.TabIndex = 3;
    this.textBox3.Text = "";
    // 
    // button2
    // 
    this.button2.Location = new System.Drawing.Point(200, 80);
    this.button2.Name = "button2";
    this.button2.Size = new System.Drawing.Size(56, 21);
    this.button2.TabIndex = 4;
    this.button2.Text = "big2gb";
    this.button2.Click += new System.EventHandler(this.button2_Click);
    // 
    // Form1
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
    this.ClientSize = new System.Drawing.Size(264, 165);
    this.Controls.AddRange(new System.Windows.Forms.Control[] {
      this.button2,
      this.textBox3,
      this.textBox2,
      this.textBox1,
      this.button1});
    this.Name = "Form1";
    this.Text = "Form1";
    this.ResumeLayout(false); }
    #endregion /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main() 
    {
    Application.Run(new Form1());
    } private void button1_Click(object sender, System.EventArgs e)
    {
    string temp1,temp2;
    temp1=textBox1.Text;
    //big to gb
    if(temp1!="")
    {
    temp2=Strings.StrConv(temp1,Microsoft.VisualBasic.VbStrConv.TraditionalChinese,0);
    textBox2.Text=temp2;
    }

    } private void button2_Click(object sender, System.EventArgs e)
    {
    //gb to big
    if(textBox2.Text!=""){
    string temp=Strings.StrConv(textBox2.Text,Microsoft.VisualBasic.VbStrConv.SimplifiedChinese,0);
    textBox3.Text=temp;
    }
    }
    }
    }
      

  10.   

    为什么c#连这么点问题都要用vb的?
      

  11.   

    basic畢竟是bill gates的起家語言,是ms的根本,所以basic才是最有未來的.