附件:http://files.cnblogs.com/xe2011/CSHARP_RichTextBoxEditor.rar

完整的转到这里 http://www.cnblogs.com/xe2011/p/3449333.html

主要的类

 using System;
//using System.Collections.Generic;
//using System.Linq;
using System.Text;
using System.Drawing;
//using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Drawing.Printing;
using System.ComponentModel;
using System.IO;
using RichTextBoxCtrl;
using richTextBoxTableClass; #region 添加引用 说明
//右键选中 引用 添加引用
//在“添加引用”对话框中,
//双击“System.Drawing.dll”和
//“System.Windows.Forms.dll”,然后单击“确定”。
#endregion namespace System.Windows.Forms
{
public class RichTextBoxCtrl : RichTextBox
{ #region RichTextBox初始化属性
/// <summary>
/// richTextBox1 = this;
/// </summary>
private System.Windows.Forms.RichTextBox richTextBox1; public RichTextBoxCtrl()
{
richTextBox1 = this;
AllowDrop = true;
EnableAutoDragDrop = true;
AcceptsTab = true;
HideSelection = false;
ScrollBars = RichTextBoxScrollBars.Vertical;
InitialRichTextBoxCtrl(); }
#endregion #region RichTextBox 新建 打开 和 保存 文件对话框 private string fileName = "未命名.rtf";
private string absFileName = ""; //文件名 返回 如 abc.rtf
public string FileName
{
get{
return fileName;
}
} //格式 C:\windows\abc.rtf
public string AbsFileName
{
get {
return absFileName;
}
} /// <summary>
/// 判断文件是否保存了
/// </summary>
private void CheckFileSave()
{
if (this.Modified)
{
string msg = "";
if (File.Exists(absFileName))
msg = "文档已修改是否保存:" + fileName;
else
msg = "文档已修改是否保存"; DialogResult Result = MessageBox.Show(msg, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (Result == DialogResult.Yes)
{
if (File.Exists(absFileName))
richTextBox1.SaveFile(absFileName);
else
this.ShowSaveFileDlg();
}
}
} /// <summary>
/// 新空的文档
/// </summary>
public void NewDocument()
{
CheckFileSave(); richTextBox1.Text = "";
richTextBox1.Modified = false; absFileName = "";
fileName = "";
} /// <summary>
/// 打开文件
/// </summary>
public void ShowOpenFileDlg()
{
CheckFileSave(); OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.DefaultExt = ".rtf";
openFileDialog1.Filter = "RTF 文档(*.rtf)|*.rtf|所有文件(*.*)|*.*";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
LoadFile(openFileDialog1.FileName);
Modified = false; absFileName = openFileDialog1.FileName;
fileName = Path.GetFileName(absFileName);
}
} //另存文件
public void ShowSaveFileDlg()
{
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.DefaultExt = ".rtf";
saveFileDialog1.Filter = "RTF 文档(*.rtf)|*.rtf|所有文件(*.*)|*.*";
saveFileDialog1.FileName = FileName;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
SaveFile(saveFileDialog1.FileName);
Modified = false; absFileName = saveFileDialog1.FileName;
fileName = Path.GetFileName(absFileName);
}
} #endregion #region 把RTF文件保存为纯文本 /// <summary>
/// 把RTF文件保存为纯文本
/// 只保存字符 转换后文本不包括RTF中的图片信息
/// </summary>
/// <param name="TextFileName">"C:\Users\Admin\Desktop\CurRoleBase.txt"</param>
public void SaveToTextFile(string TextFileName)
{
this.SaveFile(TextFileName, RichTextBoxStreamType.TextTextOleObjs);
}
#endregion #region 设置为只读模式 [DllImport("user32.dll")]
static extern bool HideCaret(IntPtr hWnd); /// <summary>
/// HideCaret
/// </summary>
/// <param name="m"></param>
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (ReadOnly)
HideCaret(Handle);
}
#endregion #region 设置 和 获得光标所在的行号和列号
///要在本类中初始化 richTextBox1 = this;
private int EM_LINEINDEX = 0x00BB;
private int EM_LINEFROMCHAR = 0x00C9; [DllImport("user32.dll", EntryPoint = "SendMessage")]
public static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam); /// <summary>
/// 获得光标所在的行号和列号
/// </summary>
/// <param name="editControl"></param>
/// <returns>p.X = 行号 p.Y =列号</returns>
public Point GetCaretPosition()
{
int charIndex = (int)SendMessage(richTextBox1.Handle, EM_LINEINDEX, -, );
int lineIndex = (int)SendMessage(richTextBox1.Handle, EM_LINEFROMCHAR, charIndex, );
Point pt=new Point();
pt.X = richTextBox1.SelectionStart - charIndex +;//Line
pt.Y = lineIndex +;//Column
return pt;
} /// <summary>
/// 转到行
/// </summary>
/// <param name="Line">行号</param>
public void jumpLine(int Line)
{
richTextBox1.SelectionStart = SendMessage(richTextBox1.Handle, EM_LINEINDEX, Line - , );
richTextBox1.SelectionLength = ;
richTextBox1.ScrollToCaret();
} /// <summary>
/// 有问题 同时设置行号和列号就出现问题了
/// </summary>
/// <param name="Column"></param>
public void jumpColumn(int Column)
{
int Line = Column; int charIndex = (int)SendMessage(richTextBox1.Handle, EM_LINEINDEX, Line - , );
int lineIndex = charIndex + (int)SendMessage(richTextBox1.Handle, EM_LINEFROMCHAR, charIndex, ); richTextBox1.SelectionStart = lineIndex;
}
#endregion #region RichTextBox 字体样式
//格式刷 /// richTextBox1 = this; /// <summary>
/// 粗体
/// </summary>
public void ToggleBold()
{
if (richTextBox1.SelectionFont == null)
richTextBox1.SelectionFont = richTextBox1.Font; FontStyle style = richTextBox1.SelectionFont.Style; if (richTextBox1.SelectionFont.Bold) style &= ~FontStyle.Bold;//恢复正常
else
style |= FontStyle.Bold; richTextBox1.SelectionFont = new Font(richTextBox1.SelectionFont, style);
} /// <summary>
/// 斜体
/// </summary>
public void ToggleItalic()
{
if (richTextBox1.SelectionFont == null)
richTextBox1.SelectionFont = richTextBox1.Font; FontStyle style = richTextBox1.SelectionFont.Style; if (richTextBox1.SelectionFont.Italic)
style &= ~FontStyle.Italic;//恢复正常
else
style |= FontStyle.Italic; richTextBox1.SelectionFont = new Font(richTextBox1.SelectionFont, style);
} /// <summary>
/// 下划线
/// </summary>
public void ToggleUnderLine()
{
if (richTextBox1.SelectionFont == null)
richTextBox1.SelectionFont = richTextBox1.Font; FontStyle style = richTextBox1.SelectionFont.Style; if (richTextBox1.SelectionFont.Underline)
style &= ~FontStyle.Underline;//恢复正常
else
style |= FontStyle.Underline; richTextBox1.SelectionFont = new Font(richTextBox1.SelectionFont, style);
} /// <summary>
/// 删除线
/// </summary>
public void ToggleStrikeout()
{
if (richTextBox1.SelectionFont == null)
richTextBox1.SelectionFont = richTextBox1.Font; FontStyle style = richTextBox1.SelectionFont.Style; if (richTextBox1.SelectionFont.Strikeout)
style &= ~FontStyle.Strikeout;//恢复正常
else
style |= FontStyle.Strikeout;
richTextBox1.SelectionFont = new Font(richTextBox1.SelectionFont, style);
} //标题1 ,标题2....
public void SetFontFormat(int index)
{
richTextBoxFontFormatClass FontFormat1 = new richTextBoxFontFormatClass();
FontFormat1.richTextBox = this;
FontFormat1.SetFontFormat(index);
} public string GetFontFormat()
{
richTextBoxFontFormatClass FontFormat1 = new richTextBoxFontFormatClass();
FontFormat1.richTextBox = this;
return FontFormat1.GetFontFormat();
} /// <summary>
/// 设置上标
/// </summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool SelectionSupperScript
{
get
{
return (SelectionCharOffset == );
}
set
{
if (SelectionCharOffset == )
{
SelectionCharOffset = ;
}
else
{
SelectionCharOffset = ;
}
}
} /// <summary>
/// 设置下标
/// </summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool SelectionSubScript
{
get
{
return (SelectionCharOffset == -);
}
set
{
if (SelectionCharOffset == )
{
SelectionCharOffset = -;
}
else
{
SelectionCharOffset = ;
} }
} /// <summary>
///RichTextBox 数字序列 1. 2. 3. 4. 5. ...
/// </summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool SelectionOrderList
{
get
{
richTextBoxBulletClass r = new richTextBoxBulletClass();
r.richTextBox = this;
return r.SelectionOrderList;
}
set
{
richTextBoxBulletClass r = new richTextBoxBulletClass();
r.richTextBox = this;
r.SelectionOrderList = value;
}
} //只须设置 不需要获得是否设置的返回值
////Tab->
public void Indent()
{
SelectionIndent += ;
}
////Tab <-
public void OutIndent()
{
SelectionIndent -= ;
} #endregion #region RichTextBox Margin
private struct Rect
{
public int Left;
public int Top;
public int Right;
public int Bottom;
} [DllImport("user32.dll")]
private static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, ref Rect lParam); private const int EM_GETRECT = 0x00b2;
private const int EM_SETRECT = 0x00b3; /// <summary>
/// 当没设置的时候结果多出了L T R +2
/// </summary>
private Rect RichTextBoxMargin
{
get
{
Rect rect = new Rect();
SendMessage(richTextBox1.Handle, EM_GETRECT, IntPtr.Zero, ref rect);
rect.Left += ;
rect.Top += ;
rect.Right = + richTextBox1.DisplayRectangle.Width - rect.Right;
rect.Bottom = richTextBox1.DisplayRectangle.Height - rect.Bottom;
return rect;
}
set
{
Rect rect;
rect.Left = richTextBox1.ClientRectangle.Left + value.Left;
rect.Top = richTextBox1.ClientRectangle.Top + value.Top;
rect.Right = richTextBox1.ClientRectangle.Right - value.Right;
rect.Bottom = richTextBox1.ClientRectangle.Bottom - value.Bottom; SendMessage(richTextBox1.Handle, EM_SETRECT, IntPtr.Zero, ref rect);
} } [Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int LeftMargin
{
get
{
return RichTextBoxMargin.Left;
}
set
{
Rect rect1;
rect1 = RichTextBoxMargin; Rect rect;
rect.Left = value;
rect.Top = ;//rect1.Top;
rect.Right = rect1.Right;
rect.Bottom = rect1.Bottom; RichTextBoxMargin = rect;
}
} [Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int RightMargin
{
get
{
return RichTextBoxMargin.Right;
}
set
{
Rect rect1;
rect1 = RichTextBoxMargin; Rect rect;
rect.Left = rect1.Left;
rect.Top = rect1.Top;
rect.Right = value;
rect.Bottom = rect1.Bottom; RichTextBoxMargin = rect;
}
} [Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int TopMargin
{
get
{
return RichTextBoxMargin.Top;
}
set
{
Rect rect1;
rect1 = RichTextBoxMargin; Rect rect;
rect.Left = rect1.Left;
rect.Top = value;
rect.Right = rect1.Right;
rect.Bottom = rect1.Bottom; RichTextBoxMargin = rect;
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int BottomMargin
{
get
{
return RichTextBoxMargin.Bottom;
}
set
{
Rect rect1;
rect1 = RichTextBoxMargin; Rect rect;
rect.Left = rect1.Left;
rect.Top = rect1.Top;
rect.Right = rect1.Right;
rect.Bottom = value;
RichTextBoxMargin = rect;
}
} #endregion #region RichTextBox 默认快捷键
/*
查找 CTRL+F
替换 CTRL+R
时间日期 F5 粗体 CTRL+B
斜体 CTRL+I
下划线 CTRL+U
*/ protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (!this.ReadOnly)
{
switch (keyData)
{
//CTRL+B
case Keys.Control | Keys.B:
ToggleBold();
return true; //CTRL+I
case Keys.Control | Keys.I:
ToggleItalic();
return true; //CTRL+U
case Keys.Control | Keys.U:
ToggleUnderLine();
return true; //shift +tab 左缩进
case Keys.Shift | Keys.Tab:
if (SelectedText != "")
{
SelectionIndent -= ;
}
return true; //shift +tab 右缩进
case Keys.Tab:
if (SelectedText != "")
{
SelectionIndent += ; }
return true; //替换对话框
case Keys.Control | Keys.R:
ShowReplaceDlg();
return true; //插入时间日期
case Keys.F5:
//2013-11-25 13:57:09
SelectedText = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
return true; //粘贴纯文本
case Keys.Control | Keys.Shift | Keys.V:
PasteAsText();
return true; case Keys.Control | Keys.G:
ShowGoToDlg();
return true; }
} if (keyData == (Keys.Control | Keys.F))
{
ShowFindDlg();
}
return false;
} #endregion #region RichTextBox 常用属性 public void PasteAsText()
{
richTextBox1.SelectedText = Clipboard.GetText(); //粘贴纯文本
} public void PasteAsBmp()
{
if (CanPasteAsBmp())
{
richTextBox1.Paste();
}
} public void PasteAsHtml()
{ } public void PasteAsUnicode()
{ } /// <summary>
/// 剪切板是否为空
/// </summary>
/// <returns></returns>
public bool CanPaste()
{
return (Clipboard.GetDataObject() != null);
} /// <summary>
/// 剪切板是否有字符串
/// </summary>
/// <returns></returns>
public bool CanPasteAsText()
{
return Clipboard.GetDataObject().GetDataPresent(DataFormats.Text);
}
/// <summary>
/// 剪切板是否有位图
/// </summary>
/// <returns></returns>
public bool CanPasteAsBmp()
{
return Clipboard.GetDataObject().GetDataPresent(DataFormats.Bitmap);
}
/// <summary>
/// 剪切板是否HTML
/// </summary>
/// <returns></returns>
public bool CanPasteAsHtml()
{
return Clipboard.GetDataObject().GetDataPresent(DataFormats.Html);
} /// <summary>
/// 是否可以全选
/// </summary>
/// <returns></returns>
public bool CanSelectAll()
{
return (richTextBox1.SelectedText.Length != richTextBox1.Text.Length);
} private void InitialRichTextBoxCtrl()
{
//ContextMenuStrip = contextMenuStrip1;
LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(richTextBox1_LinkClicked);
} /// <summary>
/// 自动打开超链接
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void richTextBox1_LinkClicked(object sender, LinkClickedEventArgs e)
{
DialogResult b = MessageBox.Show("你要打开此链接吗?\n" + e.LinkText, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
if (b == DialogResult.Yes)
{
System.Diagnostics.Process.Start("iexplore.exe", e.LinkText);
}
} #endregion #region RichTextBox 通用对话框 //private FindDialog FindDlg = new FindDialog();
//private ReplaceDialog ReplaceDlg=new ReplaceDialog(); /// <summary>
/// 查找对话框
/// </summary>
public void ShowFindDlg()
{
FindDialog FindDlg = new FindDialog();
FindDlg.richTextBox1 = this;
FindDlg.textBox1.Text = this.SelectedText;
FindDlg.StartPosition = FormStartPosition.CenterParent;
FindDlg.ShowDialog();
} /// <summary>
/// 替换 对话框
/// </summary>
public void ShowReplaceDlg()
{
ReplaceDialog ReplaceDlg = new ReplaceDialog();
ReplaceDlg.StartPosition = FormStartPosition.CenterParent;
ReplaceDlg.richTextBox1 = this;
ReplaceDlg.textBox1.Text = this.SelectedText;
ReplaceDlg.ShowDialog();
} /// <summary>
/// 字体对话框
/// </summary>
public void ShowFontDlg()
{
FontDialog fontDialog1 = new FontDialog();
fontDialog1.Font = richTextBox1.Font;
if (fontDialog1.ShowDialog() == DialogResult.OK)
{
richTextBox1.Font = fontDialog1.Font; }
}
/// <summary>
/// 转到 对话框
/// </summary>
public void ShowGoToDlg()
{
Point pt = this.GetCaretPosition(); frm_GOTO frm = new frm_GOTO();
frm.label1.Text = "等号(1 - " + this.Lines.Length.ToString() + ")(&L)";
frm.textBox1.Text = pt.X.ToString();
if (frm.ShowDialog() == DialogResult.OK)
{
int Line = Convert.ToInt32(frm.textBox1.Text);
if (Line >= )
{
if (Line > this.Lines.Length+)
{
MessageBox.Show("行数大于现有的行数");
}
else
{
this.jumpLine(Line);
}
}
}
} //RichTextBox 插入图片
public void ShowInsertImageDlg()
{
OpenFileDialog OpenFileDialog1 = new OpenFileDialog();
OpenFileDialog1.Title = "Select Image";
OpenFileDialog1.Filter = "BMP File|*.BMP|JPEG File|*.JPG|GIF File|*.GIF|PNG File|*.PNG|ICO File|*.ICO|Image File|*.BMP;*.DIB;*.RLE;*.JPG;*.JPEG;*.JPE;*.JFIF;*.GIF;*.EMF;*.WMF;*.TIF;*.PNG;*.ICO|All File|*.*";
OpenFileDialog1.FilterIndex = ;
if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
{
string strImagePath = OpenFileDialog1.FileName;
Image img;
img = Image.FromFile(strImagePath);
Clipboard.SetDataObject(img);
DataFormats.Format df;
df = DataFormats.GetFormat(DataFormats.Bitmap);
if (this.CanPaste(df))
{
this.Paste(df);
}
}
} //插入表格对话框
public void ShowInsertTableDlg()
{
richTextBoxTableDlg dlg = new richTextBoxTableDlg();
dlg.richTextBox = this; if (dlg.ShowDialog() == DialogResult.OK)
{
richTextBoxTable r1 = new richTextBoxTable();
r1.richTextBox = this;
r1.cellWidth = (int)dlg.numericUpDownCellWidth.Value;
r1.InsertTable((int)dlg.numericUpDownColumn.Value, (int)dlg.numericUpDownRow.Value, dlg.radioButtonAutoSzie.Checked);
}
} public void ShowViewSourceDlg()
{
ViewRtfSoruceDlg rtfdlg = new ViewRtfSoruceDlg(); string s = string.Format("文件很大 请等待... {0}KB", (richTextBox1.Rtf.Length /)); //if (richTextBox1.Rtf.Length > 1024*1024)
// MessageBox.Show(s); rtfdlg.textBox1.Text = richTextBox1.Rtf;
if (rtfdlg.ShowDialog()==DialogResult.OK)
{
richTextBox1.Rtf = rtfdlg.textBox1.Text;
}
Application.DoEvents();
}
#endregion #region RichTextBox 是否显示行号
#endregion #region 实现 页面设置 打印预览 打印 //页面设置
public void ShowPageSetupDlg()
{
richTextBoxPrintClass r = new richTextBoxPrintClass();
r.richTextBox = this;
r.ShowPageSetupDlg();
}
//打印预览功能
public void ShowShowPagePriviewDlg()
{
richTextBoxPrintClass r = new richTextBoxPrintClass();
r.richTextBox = this;
r.ShowShowPagePriviewDlg();
} //打印
public void ShowPrintDlg()
{
richTextBoxPrintClass r = new richTextBoxPrintClass();
r.richTextBox = this;
r.ShowPrintDlg();
}
#endregion #region 支持表格正确粘贴 // P/Invoke declarations
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr LoadLibrary(string path); private static IntPtr moduleHandle; protected override CreateParams CreateParams
{
get
{
if (moduleHandle == IntPtr.Zero)
{
moduleHandle = LoadLibrary("msftedit.dll");
if ((long)moduleHandle < 0x20)
{
throw new Win32Exception(Marshal.GetLastWin32Error(), "Could not load Msftedit.dll");
}
} CreateParams createParams = base.CreateParams;
createParams.ClassName = "RichEdit50W";
if (this.Multiline)
{
if (((this.ScrollBars & RichTextBoxScrollBars.Horizontal) != RichTextBoxScrollBars.None) && !base.WordWrap)
{
createParams.Style |= 0x100000;
if ((this.ScrollBars & ((RichTextBoxScrollBars)0x10)) != RichTextBoxScrollBars.None)
{
createParams.Style |= 0x2000;
}
}
if ((this.ScrollBars & RichTextBoxScrollBars.Vertical) != RichTextBoxScrollBars.None)
{
createParams.Style |= 0x200000;
if ((this.ScrollBars & ((RichTextBoxScrollBars)0x10)) != RichTextBoxScrollBars.None)
{
createParams.Style |= 0x2000;
}
}
}
if ((BorderStyle.FixedSingle == base.BorderStyle) && ((createParams.Style & 0x800000) != ))
{
createParams.Style &= -;
createParams.ExStyle |= 0x200;
}
return createParams;
}
}
#endregion
} }

RichTextBoxCtrl.CS

//

 using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices; //2013-11-27 02:00:13
////清除样式
//richTextBoxBulletClass r = new richTextBoxBulletClass();
//r.richTextBox = richTextBox1;
//r.RemoveSelectionParaFormat2(); ////属性获得 //richTextBoxBulletClass r = new richTextBoxBulletClass();
//r.richTextBox = richTextBox1;
//btn.Checked = r.SelectionOrderList; ////设置样式
//richTextBoxBulletClass r = new richTextBoxBulletClass();
//r.richTextBox = richTextBox1;
//r.SelectionOrderList = !r.SelectionOrderList; namespace RichTextBoxCtrl
{
class richTextBoxBulletClass
{
public RichTextBox richTextBox;
public richTextBoxBulletClass()
{
richTextBox = new RichTextBox();
} #region PARAFORMAT2
[StructLayout(LayoutKind.Sequential)]
private class PARAFORMAT2
{
public int cbSize;
public int dwMask;
public short wNumbering;
public short wReserved;
public int dxStartIndent;
public int dxRightIndent;
public int dxOffset;
public short wAlignment;
public short cTabCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x20)]
public int[] rgxTabs; public int dySpaceBefore; // Vertical spacing before para
public int dySpaceAfter; // Vertical spacing after para
public int dyLineSpacing; // Line spacing depending on Rule
public short sStyle; // Style handle
public byte bLineSpacingRule; // Rule for line spacing (see tom.doc)
public byte bOutlineLevel; // Outline Level
public short wShadingWeight; // Shading in hundredths of a per cent
public short wShadingStyle; // Byte 0: style, nib 2: cfpat, 3: cbpat
public short wNumberingStart; // Starting value for numbering
public short wNumberingStyle; // Alignment, Roman/Arabic, (), ), ., etc.
public short wNumberingTab; // Space bet 1st indent and 1st-line text
public short wBorderSpace; // Border-text spaces (nbl/bdr in pts)
public short wBorderWidth; // Pen widths (nbl/bdr in half twips)
public short wBorders; // Border styles (nibble/border) public PARAFORMAT2()
{
this.cbSize = Marshal.SizeOf(typeof(PARAFORMAT2));
}
}
#endregion #region PARAFORMAT MASK VALUES public const uint WM_USER = 0x0400;
// RichEdit messages
public const uint EM_GETPARAFORMAT = (WM_USER + );
public const uint EM_SETPARAFORMAT = (WM_USER + ); // PARAFORMAT mask values
public const uint PFM_OFFSET = 0x00000004;
public const uint PFM_NUMBERING = 0x00000020; // PARAFORMAT 2.0 masks and effects
public const uint PFM_NUMBERINGSTYLE = 0x00002000;//设置项目编号的样式
public const uint PFM_NUMBERINGTAB = 0x00004000;//设置项目编号按下Tab键的信息
public const uint PFM_NUMBERINGSTART = 0x00008000;//设置项目编号的开始标识 //wNumbering
//Options used for bulleted or numbered paragraphs.
//To use this member, set the PFM_NUMBERING flag in the dwMask member.
//This member can be one of the following values.
public enum Paraformat2Numbering
{
zero = ,
Normal = , //No paragraph numbering or bullets.
ArabicNumbers = , //Uses Arabic numbers (1, 2, 3, ...).
LowerCaseLetter = , //Uses lowercase letters (a, b, c, ...).
UpperCaseLetter = , //Uses uppercase letters (A, B, C, ...).
LowerCaseRoman = , //Uses lowercase Roman numerals (i, ii, iii, ...).
UpperCaseRoman = //Uses uppercase Roman numerals (I, II, III, ...).
} //wNumberingStyle
//Numbering style used with numbered paragraphs.
//Use this member in conjunction with the wNumbering member.
//This member is included only for compatibility with TOM interfaces;
//the rich edit control stores the value but rich edit versions earlier than 3.0 do not use it to display the text or bullets.
//To use this member, set the PFM_NUMBERINGSTYLE flag in the dwMask member.
//This member can be one of the following values.
public enum Paraformat2NumberingStyle
{
RightParenthesis = 0x000,//Follows the number with a right parenthesis.
DoubleParenthesis = 0x100,//Encloses the number in parentheses.
Period = 0x200,//Follows the number with a period.
Plain = 0x300,//Displays only the number.
zero = 0x400//Continues a numbered list without applying the next number or bullet.
} #endregion #region SetSelectionParaFormat2 [DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, uint msg, uint wParam, [In, Out, MarshalAs(UnmanagedType.LPStruct)] PARAFORMAT2 lParam); public void SetSelectionParaFormat2(Paraformat2NumberingStyle style, Paraformat2Numbering Number)
{
PARAFORMAT2 p = new PARAFORMAT2();
p.dwMask = (int)(PFM_NUMBERING | PFM_OFFSET | PFM_NUMBERINGSTART | PFM_NUMBERINGSTYLE | PFM_NUMBERINGTAB); p.wNumbering = (short)Number;
//p.dxOffset = BulletIndent;
p.wNumberingStyle = (short)style;
p.wNumberingStart = ;
p.wNumberingTab = ; SendMessage(richTextBox.Handle, EM_SETPARAFORMAT, , p);
}
#endregion //获得 wNumbering的返回值
public Paraformat2Numbering GetSelectionParaformat2wNumbering()
{
PARAFORMAT2 p = new PARAFORMAT2();
SendMessage(richTextBox.Handle, EM_GETPARAFORMAT, , p);
return (Paraformat2Numbering)p.wNumbering;
} //获得wNumberingStyleg的返回值
public Paraformat2NumberingStyle GetSelectionParaformat2wNumberingStyle()
{
PARAFORMAT2 p = new PARAFORMAT2();
SendMessage(richTextBox.Handle, EM_GETPARAFORMAT, , p);
return (Paraformat2NumberingStyle)p.wNumberingStyle;
} #region 更多样式... ... private void test()
{
//●●●●
SetSelectionParaFormat2(Paraformat2NumberingStyle.Period, Paraformat2Numbering.Normal);
//1 2 3 4 5 ...
SetSelectionParaFormat2(Paraformat2NumberingStyle.Plain, Paraformat2Numbering.ArabicNumbers);
//1. 2. 3. 4. 5. ...
SetSelectionParaFormat2(Paraformat2NumberingStyle.Period, Paraformat2Numbering.ArabicNumbers);
//1) 2) 3) 4) ...
SetSelectionParaFormat2(Paraformat2NumberingStyle.RightParenthesis, Paraformat2Numbering.ArabicNumbers);
//(1) (2) (3) (4) ...
SetSelectionParaFormat2(Paraformat2NumberingStyle.DoubleParenthesis, Paraformat2Numbering.ArabicNumbers);
////////////////////////////////////////////////////////////////////////// //a b c d e
SetSelectionParaFormat2(Paraformat2NumberingStyle.Plain, Paraformat2Numbering.LowerCaseLetter);
//a. b. c. d. e.
SetSelectionParaFormat2(Paraformat2NumberingStyle.Period, Paraformat2Numbering.LowerCaseLetter);
//a) b) c) d) e)
SetSelectionParaFormat2(Paraformat2NumberingStyle.RightParenthesis, Paraformat2Numbering.LowerCaseLetter);
//(a) (b) (c) (d) (e)
SetSelectionParaFormat2(Paraformat2NumberingStyle.DoubleParenthesis, Paraformat2Numbering.LowerCaseLetter);
////////////////////////////////////////////////////////////////////////// //A B C D E
SetSelectionParaFormat2(Paraformat2NumberingStyle.Plain, Paraformat2Numbering.UpperCaseLetter);
//A. B. C. D. E.
SetSelectionParaFormat2(Paraformat2NumberingStyle.Period, Paraformat2Numbering.UpperCaseLetter);
//A) B) C) D) E)
SetSelectionParaFormat2(Paraformat2NumberingStyle.RightParenthesis, Paraformat2Numbering.UpperCaseLetter);
//(A) (B) (C) (D) (E)
SetSelectionParaFormat2(Paraformat2NumberingStyle.DoubleParenthesis, Paraformat2Numbering.UpperCaseLetter);
////////////////////////////////////////////////////////////////////////// //I II III IIII IV
SetSelectionParaFormat2(Paraformat2NumberingStyle.Plain, Paraformat2Numbering.LowerCaseRoman);
//I. II. III. IIII. IV.
SetSelectionParaFormat2(Paraformat2NumberingStyle.Period, Paraformat2Numbering.LowerCaseRoman);
//I) II) III) IIII) IV)
SetSelectionParaFormat2(Paraformat2NumberingStyle.RightParenthesis, Paraformat2Numbering.LowerCaseRoman);
//(I) (II) (III) (IIII) (IV)
SetSelectionParaFormat2(Paraformat2NumberingStyle.DoubleParenthesis, Paraformat2Numbering.LowerCaseRoman);
////////////////////////////////////////////////////////////////////////// }
#endregion //清除选中的样式
public void RemoveSelectionParaFormat2()
{
SetSelectionParaFormat2(, );
} #region 数字序列 1. 2. 3. 4. 5. ...
private bool bOrder = false;
public bool SelectionOrderList
{
get
{
return (
(GetSelectionParaformat2wNumbering() == Paraformat2Numbering.ArabicNumbers) &&
(GetSelectionParaformat2wNumberingStyle() == Paraformat2NumberingStyle.Period)
); }
set
{
bOrder = value; if (value == true)
SetSelectionParaFormat2(Paraformat2NumberingStyle.Period, Paraformat2Numbering.ArabicNumbers);
else
RemoveSelectionParaFormat2();
}
}
#endregion }
}

richTextBoxBulletClass.CS

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing; //使用
////set font Size font Style bold Italic
////
////普通 not bold italic
////标题1 字体大小 24 Bold
////标题2 字体大小 18 Bold
////标题3 字体大小 14 Bold
////标题4 字体大小 12 Bold
////标题5 字体大小 10 Bold
////标题6 字体大小 8 Bold
////地址 字体大小 12 Italic //private RichTextBoxCtrl.richTextBoxFontFormatClass r = new RichTextBoxCtrl.richTextBoxFontFormatClass();
//private void Form1_Load(object sender, EventArgs e)
//{
// r.richTextBox = richTextBox1;
// comboBox1.Items.Clear();
// comboBox1.Items.AddRange(new object[] {
// "普通",
// "标题1",
// "标题2",
// "标题3",
// "标题4",
// "标题5",
// "标题6",
// "地址 "});
//} //private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
//{
// r.SetFontFormat(comboBox1.SelectedIndex); // //SetFontFormat(comboBox1.SelectedIndex);
// Text = r.GetFontFormat().ToString();
//} //private void richTextBox1_SelectionChanged(object sender, EventArgs e)
//{
// Text = r.GetFontFormat();
// comboBox1.Text = r.GetFontFormat();
//} namespace RichTextBoxCtrl
{
class richTextBoxFontFormatClass
{
public richTextBoxFontFormatClass()
{ }
public RichTextBox richTextBox; public void SetFontFormat(int formatIndex)
{
float fontSize = richTextBox.Font.Size;
string fontName = richTextBox.Font.Name;
switch (formatIndex)
{
case ://普通
richTextBox.SelectionFont = new Font(fontName, fontSize, FontStyle.Regular);
break;
case ://标题1
richTextBox.SelectionFont = new Font(fontName, 24f, FontStyle.Bold);
break;
case : //标题2
richTextBox.SelectionFont = new Font(fontName, 18f, FontStyle.Bold);
break;
case : //标题3
richTextBox.SelectionFont = new Font(fontName, 14f, FontStyle.Bold);
break;
case ://标题4
richTextBox.SelectionFont = new Font(fontName, 12f, FontStyle.Bold);
break;
case : //标题5
richTextBox.SelectionFont = new Font(fontName, 10f, FontStyle.Bold);
break;
case : //标题6
richTextBox.SelectionFont = new Font(fontName, 8f, FontStyle.Bold);
break;
case : //地址
richTextBox.SelectionFont = new Font(fontName, 12f, FontStyle.Italic);
break;
}
}
public string GetFontFormat()
{
string Result = "普通";
if (richTextBox.SelectionFont !=null )
{
float fontSize = richTextBox.SelectionFont.Size;
FontStyle fontStyle = richTextBox.SelectionFont.Style; if (fontSize == && fontStyle == FontStyle.Bold)
Result = "标题1";
else
if (fontSize == && fontStyle == FontStyle.Bold)
Result = "标题2";
else
if (fontSize == && fontStyle == FontStyle.Bold)
Result = "标题3";
else
if (fontSize == && fontStyle == FontStyle.Bold)
Result = "标题4";
else
if (fontSize == && fontStyle == FontStyle.Bold)
Result = "标题5";
else
if (fontSize == && fontStyle == FontStyle.Bold)
Result = "标题6";
else
if (fontSize == && fontStyle == FontStyle.Italic)
Result = "地址";
else
Result = "普通";
}
else
Result = "普通";
return Result;
}
}
}

richTextBoxFontFormatClass.CS

 using System;
using System.Windows.Forms;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Drawing.Printing; #region 调用示例
/*使用
//页面设置
private void btnPageSetup_Click(object sender, EventArgs e)
{
richTextBoxPrintClass r = new richTextBoxPrintClass();
r.richTextBox = richTextBox1;
r.ShowPageSetupDlg();
}
//打印预览功能
private void btnPrintPreview_Click(object sender, EventArgs e)
{
richTextBoxPrintClass r = new richTextBoxPrintClass();
r.richTextBox = richTextBox1;
r.ShowShowPagePriviewDlg();
}
//打印
private void btnPrint_Click(object sender, EventArgs e)
{
richTextBoxPrintClass r = new richTextBoxPrintClass();
r.richTextBox = richTextBox1;
r.ShowPrintDlg();
}
*/
#endregion
//http://support.microsoft.com/kb/812425/zh-cn
namespace RichTextBoxCtrl
{
class richTextBoxPrintClass
{
public richTextBoxPrintClass()
{
InitializeComponent();
}
#region 打印功用 //and the unit used by Win32 API calls (twips 1/1440 inch)
private const double anInch = 14.4; [StructLayout(LayoutKind.Sequential)]
private struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
} [StructLayout(LayoutKind.Sequential)]
private struct CHARRANGE
{
public int cpMin; //First character of range (0 for start of doc)
public int cpMax; //Last character of range (-1 for end of doc)
} [StructLayout(LayoutKind.Sequential)]
private struct FORMATRANGE
{
public IntPtr hdc; //Actual DC to draw on
public IntPtr hdcTarget; //Target DC for determining text formatting
public RECT rc; //Region of the DC to draw to (in twips)
public RECT rcPage; //Region of the whole DC (page size) (in twips)
public CHARRANGE chrg; //Range of text to draw (see earlier declaration)
} private const int WM_USER = 0x0400;
private const int EM_FORMATRANGE = WM_USER + ; [DllImport("USER32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp); // Render the contents of the RichTextBox for printing
// Return the last character printed + 1 (printing start from this point for next page)
public static int Print(RichTextBox richTextBox, int charFrom, int charTo, PrintPageEventArgs e)
{
//Calculate the area to render and print
RECT rectToPrint;
rectToPrint.Top = (int)(e.MarginBounds.Top * anInch);
rectToPrint.Bottom = (int)(e.MarginBounds.Bottom * anInch);
rectToPrint.Left = (int)(e.MarginBounds.Left * anInch);
rectToPrint.Right = (int)(e.MarginBounds.Right * anInch); //Calculate the size of the page
RECT rectPage;
rectPage.Top = (int)(e.PageBounds.Top * anInch);
rectPage.Bottom = (int)(e.PageBounds.Bottom * anInch);
rectPage.Left = (int)(e.PageBounds.Left * anInch);
rectPage.Right = (int)(e.PageBounds.Right * anInch); IntPtr hdc = e.Graphics.GetHdc(); FORMATRANGE fmtRange;
fmtRange.chrg.cpMax = charTo; //Indicate character from to character to
fmtRange.chrg.cpMin = charFrom;
fmtRange.hdc = hdc; //Use the same DC for measuring and rendering
fmtRange.hdcTarget = hdc; //Point at printer hDC
fmtRange.rc = rectToPrint; //Indicate the area on page to print
fmtRange.rcPage = rectPage; //Indicate size of page IntPtr res = IntPtr.Zero; IntPtr wparam = IntPtr.Zero;
wparam = new IntPtr(); //Get the pointer to the FORMATRANGE structure in memory
IntPtr lparam = IntPtr.Zero;
lparam = Marshal.AllocCoTaskMem(Marshal.SizeOf(fmtRange));
Marshal.StructureToPtr(fmtRange, lparam, false); //Send the rendered data for printing
res = SendMessage(richTextBox.Handle, EM_FORMATRANGE, wparam, lparam); //Free the block of memory allocated
Marshal.FreeCoTaskMem(lparam); //Release the device context handle obtained by a previous call
e.Graphics.ReleaseHdc(hdc); //Return last + 1 character printer
return res.ToInt32();
} #endregion #region 初始化
public RichTextBox richTextBox;
private PageSetupDialog pageSetupDialog1;
private PrintDialog printDialog1;
private PrintDocument printDocument1;
private PrintPreviewDialog printPreviewDialog1; private void InitializeComponent()
{
richTextBox = new RichTextBox();
pageSetupDialog1 = new PageSetupDialog();
printDialog1 = new PrintDialog();
printDocument1 = new PrintDocument();
printPreviewDialog1 = new PrintPreviewDialog(); //
// pageSetupDialog1
//
pageSetupDialog1.Document = printDocument1;
//
// printDialog1
//
printDialog1.Document = printDocument1;
printDialog1.UseEXDialog = true;
//
// printDocument1
//
printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(printDocument1_PrintPage);
printDocument1.BeginPrint += new System.Drawing.Printing.PrintEventHandler(printDocument1_BeginPrint);
//
// printPreviewDialog1
// printPreviewDialog1.AutoScrollMargin = new System.Drawing.Size(, );
printPreviewDialog1.AutoScrollMinSize = new System.Drawing.Size(, );
printPreviewDialog1.ClientSize = new System.Drawing.Size(, );
printPreviewDialog1.Document = printDocument1;
printPreviewDialog1.Enabled = true;
// printPreviewDialog1.Icon = ((System.Drawing.Icon)(resources.GetObject("printPreviewDialog1.Icon")));
printPreviewDialog1.Name = "printPreviewDialog1";
printPreviewDialog1.Visible = false;
} private int checkPrint;
private void printDocument1_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
checkPrint = ;
} private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
// Print the content of RichTextBox. Store the last character printed.
//checkPrint = richTextBoxPrintCtrl1.Print(checkPrint, richTextBoxPrintCtrl1.TextLength, e);
checkPrint = richTextBoxPrintClass.Print(richTextBox, checkPrint, richTextBox.TextLength, e); // Check for more pages
if (checkPrint < richTextBox.TextLength)
e.HasMorePages = true;
else
e.HasMorePages = false;
} #endregion //页面设置功能
public void ShowPageSetupDlg()
{
pageSetupDialog1.ShowDialog();
} //打印预览功能
public void ShowShowPagePriviewDlg()
{
printPreviewDialog1.ShowDialog();
} //打印
public void ShowPrintDlg()
{
if (printDialog1.ShowDialog() == DialogResult.OK)
printDocument1.Print();
}
}
}

richTextBoxPrintClass.CS

 using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Text; //private void button2_Click(object sender, EventArgs e)
//{
// richTextBoxTableDlg dlg = new richTextBoxTableDlg();
// dlg.richTextBox = richTextBox51; // if (dlg.ShowDialog() ==DialogResult.OK)
// {
// richTextBoxTable r1 = new richTextBoxTable();
// r1.richTextBox = richTextBox51;
// r1.cellWidth = (int)dlg.numericUpDownCellWidth.Value ;
// r1.InsertTable((int)dlg.numericUpDownColumn.Value, (int)dlg.numericUpDownRow.Value, dlg.radioButtonAutoSzie.Checked);
// }
//}
/*
* 光标在表格上可以改变光标
*/ namespace richTextBoxTableClass
{
public class richTextBoxTable
{ public richTextBoxTable()
{ } public RichTextBox richTextBox;
public int cellWidth;// = 1000;//default =1000 /// <summary>
/// 插入表格
/// </summary>
/// <param name="col">行</param>
/// <param name="row">列</param>
/// <param name="AutoSize">=TRUE:自动设置每个单元格的大小</param>
public void InsertTable(int col, int row,bool AutoSize)
{
StringBuilder rtf = new StringBuilder();
rtf.Append(@"{\rtf1 "); //int cellWidth = 1000;//col.1 width =1000
if (AutoSize)
//滚动条出现时 (richTextBox.ClientSize.Width - 滚动条的宽 /列的个数)*15
cellWidth = ((richTextBox.ClientSize.Width-) / row) * ;
for (int i = ; i < col; i++)
{
rtf.Append(@"\trowd");
for (int j = ; j <= row; j++)
rtf.Append(@"\cellx" + (j * cellWidth).ToString());
rtf.Append(@"\intbl \cell \row"); //create row
}
rtf.Append(@"\pard");
rtf.Append(@"}");
richTextBox.SelectedRtf = rtf.ToString();
//return rtf.ToString();
}
}
}

richTextBoxTableClass

C# richTextBox编辑器的更多相关文章

  1. C# RichTextBox 制作文本编辑器

    本文利用一个简单的小例子[文本编辑器],讲解RichTextBox的用法,仅供学习分享使用,如有不足之处,还请指正. Windows窗体中的RichTextBox控件用于显示,输入和操作格式化的文本, ...

  2. wpf 富文本编辑器richtextbox的简单用法

    最近弄得一个小软件,需要用到富文本编辑器,richtextbox,一开始以为是和文本框一样的用法,但是实践起来碰壁之后才知道并不简单. richtextbox 类似于Word,是一个可编辑的控件.结构 ...

  3. WPF RichTextBox读取存储文本的方法和常用属性

    1. 取得已被选中的内容: (1)使用 RichTextBox.Document.Selection属性(2)访问RichTextBox.Document.Blocks属性的“blocks”中的Tex ...

  4. WPF RichTextBox 控件常用方法和属性

    以下内容转自 http://blog.csdn.net/yulongguiziyao/article/details/25330551. 1. 取得已被选中的内容: (1)使用 RichTextBox ...

  5. 解决 RichTextBox 文件格式不对问题

    RichTextBox文件格式不对: 原因:富文本框的LoadFile方法只支持RTF格式的文件或者标准的ASCII文本本档,,我们一般的文本文档是ANSI或者UTF-8的格式,所以,报这个错. 解决 ...

  6. 【Kindeditor编辑器】 文件上传、空间管理

    包括图片上传.文件上传.Flash上传.多媒体上传.空间管理(图片空间.文件空间等等) 一.编辑器相关参数 二.简单的封装类 这里只是做了简单的封装,欢迎大家指点改正. public class Ki ...

  7. 在richtextbox中获取最真实的字符串像素大小

    设计器: partial class Form1 { /// <summary> /// 必需的设计器变量. /// </summary> private System.Com ...

  8. C# RichTextBox实现背景透明

    这几天在做一个文本编辑器,要将RichTextBox的背景透明,但是发现C#的RichTextBox是不支持将背景设置为Transparent(透明). 网上找了好多方法,但都不行. 后来自己想了个办 ...

  9. NiceMark——我的Markdown编辑器

    NiceMark--我的Markdown编辑器 闲来无事,写了一个Markdown编辑器.基于electron,完全采用Web前段技术(Html,css,JavaScript)实现.代码已托管在Git ...

随机推荐

  1. __attribute__ 详解

    GNU C的一大特色(却不被初学者所知)就是__attribute__机制.__attribute__可以设置函数属性(Function    Attribute).变量属性(Variable Att ...

  2. 除了判断语句if switch 我们还可以怎么做?-b

    之前项目中有根据后台数据执行不同代码,根据不同的字符串返回不同UIViewController对象,最开始需要的vc 种类不多我用的是if else 做字符串比较再执行不同代码,但是如果需求的vc 有 ...

  3. IntelliJ IDEA配置缓存地址

    idea的配置缓存路径是保存配置文件和插件的本地目录,对idea上的所有个人修改全都储存在那里 相比于eclipse的免安装.解压即用来说,一旦系统重装或者idea重装又没有进行备份的情况下,个人对i ...

  4. [Jquery] js获取浏览器滚动条距离顶端的距离

    需要用js获取滚动条距离窗口顶端的距离和js获取浏览器可视化窗口的大小  一.jQuery获取的相关方法 jquery 获取滚动条高度 获取浏览器显示区域的高度 : $(window).height( ...

  5. 【BZOJ 1233】 [Usaco2009Open]干草堆tower (单调队列优化DP)

    1233: [Usaco2009Open]干草堆tower Description 奶牛们讨厌黑暗. 为了调整牛棚顶的电灯的亮度,Bessie必须建一座干草堆使得她能够爬上去够到灯泡 .一共有N大包的 ...

  6. easyui datagrid单击单元格选择此列

    示例代码实现单击jquery easyui datagrid的单元格时,取消datagrid默认选中高亮此行的样式,改为选中单击的单元格所在的列,高亮此列上的所有单元格.可以配置全局single变量, ...

  7. SPRING IN ACTION 第4版笔记-第一章-005-Bean的生命周期

    一. 1. As you can see, a bean factory performs several setup steps before a bean is ready touse. Let’ ...

  8. C51 的编程规范

    编程首要是要考虑程序的可行性,然后是可读性.可移植性.健壮性以及可测试性.这是总则.但是很多人忽略了可读性.可移植性和健壮性(可调试的方法可能歌不相同),这是不对的. 1.当项目比较大时,最好分模块编 ...

  9. 江中微型统计分析软件V1.0版本完成

    中文名称:江中微型统计分析软件 英文名称: 项目名称:JXUTCMMSAS 项目地址:保密 在研究生最后历时1年的时间里,完成了江中微型统计分析软件V1.0,后续还在不断更新中,将自己的改进算法.机器 ...

  10. java基于xml配置的通用excel单表数据导入组件(五、Action处理类)

    package xxxxxx.manage.importexcel; import java.io.File; import java.util.HashMap; import java.util.M ...