给你的对文件操作的类吧:
public class FileControl
{
public FileControl()
{
}
/**/
///
/// 在根目录下创建文件夹
///
/// 要创建的文件路径
public void CreateFolder(string FolderPathName)
{
if (FolderPathName.Trim().Length > 0)
{
try
{
string CreatePath = System.Web.HttpContext.Current.Server.MapPath
("../../../Images/" + FolderPathName).ToString();
if (!Directory.Exists(CreatePath))
{
Directory.CreateDirectory(CreatePath);
}
}
catch(Exception ex)
{
throw;
}
}
}
/**/
///
/// 删除一个文件夹下面的字文件夹和文件
///
///
public void DeleteChildFolder(string FolderPathName)
{
if (FolderPathName.Trim().Length > 0)
{
try
{
string CreatePath = System.Web.HttpContext.Current.Server.MapPath
(FolderPathName).ToString();
if (Directory.Exists(CreatePath))
{
Directory.Delete(CreatePath, true);
}
}
catch(Exception ex)
{
throw;
}
}
}
/**/
///
/// 删除一个文件
///
///
public void DeleteFile(string FilePathName)
{
try
{
FileInfo DeleFile = new FileInfo(System.Web.HttpContext.Current.Server.MapPath
(FilePathName).ToString());
DeleFile.Delete();
}
catch(Exception ex)
{
throw;
}
}
public void CreateFile(string FilePathName)
{
try
{
//创建文件夹
//string[] strPath= FilePathName.Split('/');
//CreateFolder(FilePathName.Replace("/" + strPath[strPath.Length-1].ToString(),"")); //创建文件夹
FileInfo CreateFile =new FileInfo(FilePathName); //创建文件
if(!CreateFile.Exists)
{
FileStream FS=CreateFile.Create();
FS.Close();
}
}
catch(Exception ex)
{
throw;
}
}
/**/
///
/// 删除整个文件夹及其字文件夹和文件
///
///
public void DeleParentFolder(string FolderPathName)
{
try
{
DirectoryInfo DelFolder = new DirectoryInfo(System.Web.HttpContext.Current.Server.MapPath
(FolderPathName).ToString());
if (DelFolder.Exists)
{
DelFolder.Delete();
}
}
catch
{
}
}
/**/
///
/// 在文件里追加内容
///
///
public void ReWriteReadinnerText(string FilePathName, string WriteWord)
{
try
{
//建立文件夹和文件
//CreateFolder(FilePathName);
//CreateFile(FilePathName);
//得到原来文件的内容
FileStream FileRead = new FileStream(FilePathName, FileMode.Append,FileAccess.Write);
//StreamReader FileReadWord = new StreamReader(FileRead, System.Text.Encoding.Default);
//string OldString = FileReadWord.ReadToEnd().ToString();
//OldString = OldString + WriteWord;
//把新的内容重新写入
StreamWriter FileWrite = new StreamWriter(FileRead, System.Text.Encoding.Default);
FileWrite.Write(WriteWord);
//关闭
FileWrite.Close();
//FileReadWord.Close();
FileRead.Close();
}
catch(Exception ex)
{
// throw;
}
}
/**/
///
/// 在文件里追加内容
///
///
public string ReaderFileData(string FilePathName)
{
try
{
FileStream FileRead = new FileStream(System.Web.HttpContext.Current.Server.MapPath
(FilePathName).ToString(), FileMode.Open, FileAccess.Read);
StreamReader FileReadWord = new StreamReader(FileRead, System.Text.Encoding.Default);
string TxtString = FileReadWord.ReadToEnd().ToString();
//关闭
FileReadWord.Close();
FileRead.Close();
return TxtString;
}
catch
{
throw;
}
}
/**/
///
/// 读取文件夹的文件
///
///
///
public DirectoryInfo checkValidSessionPath(string FilePathName)
{
try
{
DirectoryInfo MainDir = new DirectoryInfo(System.Web.HttpContext.Current.Server.MapPath
(FilePathName));
return MainDir;
}
catch
{
throw;
}
}
}
我用这个操作文本文件,应该也可以操作WORD文档.
另外给个C#操纵WORD文档的例子
http://blog.csdn.net/viniboy1982/archive/2006/12/06/1432472.aspx
如何从数据库将图片读取到Word
找到数据库存放图片的路径,复制-粘贴到word。
如何把照片格式转换成word或excel格式,读取照片里面的文字
工具/原料
任意品牌型号手机 微信最新版
方法/步骤
1、首先,将电脑上的图片存到手机上,打开手机微信,点击“通讯录”,在顶部搜索框中,输入“表格识别”,点击第一项。
2、在新页面点击第一个,“表格识别”。
3、打开后进入界面,点击“相册中选择图片”。
4、识别成功,点击复制表格链接。
5、根据图中说明操作即可。
用VC读取word中的图片
直接将word文档另存为网页文件就可以了,简单又快捷
如何读取word文档中的文字图片
如下:
1、2003版本有对应的处理方法,将图片文件转为文字内容。
http://jingyan.baidu.com/article/c74d60007bc7510f6a595d3c.html
软件可下载:Microsoft Office Document Imaging简体中文版
2、也可以使用ocr文字识别软件进行转换。
谁有较为简单的把图片上的文字直接读取成Word的方法?
用OFFICE完整版,Microsoft工具里面有个 Office Document Imaging就可以把图片上的文字读成WORD的,但要注意一个就是读取不了表格
java 读取word自选图片
用WPS能直接转成JPEG
想清楚点的话把图拉大点再转
或先转PDF再用ps转成JPEG
用word2007也可以,360里软件下载有直接有Wps下载
怎么从word和excel中读取图片和文字
试试使用菜单中的 文件==》另存为==》网页 能否满足你的要求,这样里面的图片都会保存在一个文件夹里面。
转载请注明出处51数据库 » 读取word图片 c#中读取word里的图片