115 lines
3.4 KiB
C#
115 lines
3.4 KiB
C#
using BizCom;
|
|
using SevenZip;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Threading;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
public partial class _Default : System.Web.UI.Page
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
|
|
|
|
//string fileName = "(C2_1975999718512169836)-80x40mm-1000张-不干胶铜版纸烫金覆膜模切--YJSJ-郑凌宇1-四川省-金陵-[C2].cdr";
|
|
//string ctid = MidStrEx(fileName, "(", ")").Trim();
|
|
|
|
// CeErpTradeCell entity=CeErpTradeCell.GetByCtid("C2_1975999718512169836");
|
|
//entity.Update();
|
|
//Response.Write(entity.ctid + "<br>");
|
|
//if (IntPtr.Size == 4)
|
|
//{
|
|
// SevenZipCompressor.SetLibraryPath(@"D:\fireant\ecomerp\UploadWeb\Bin\x64\7z.dll");
|
|
//}
|
|
//else
|
|
//{
|
|
// SevenZipCompressor.SetLibraryPath(@"D:\fireant\ecomerp\UploadWeb\Bin\x86\7z.dll");
|
|
//}
|
|
//SevenZipCompressor.SetLibraryPath(@"D:\fireant\ecomerp\UploadWeb\Bin\x64\7z.dll");
|
|
//SevenZipExtractor.SetLibraryPath(@"\x64\7z.dll");
|
|
|
|
//SevenZip.SevenZipExtractor
|
|
|
|
//LibraryFeature lf = SevenZipExtractor.CurrentLibraryFeatures;
|
|
SevenZipExtractor.SetLibraryPath(Server.MapPath("bin\\7z.dll"));
|
|
//var path = Path.Combine(Server.MapPath("bin"), Environment.Is64BitProcess ? "x64" : "x86", "7z.dll");
|
|
//SevenZip.SevenZipBase.SetLibraryPath(path);
|
|
//SevenZipExtractor.SetLibraryPath(path);
|
|
|
|
//using (SevenZipExtractor szExtra = new SevenZipExtractor("d:\\4.rar"))
|
|
// {
|
|
//szExtra.ExtractArchive("d:\\temp");
|
|
// foreach (string afn in szExtra.ArchiveFileNames)
|
|
//{
|
|
//if (afn.IndexOf("123123", StringComparison.OrdinalIgnoreCase) != -1)
|
|
// szExtra.ExtractFiles("d:\\temp", afn);
|
|
// }
|
|
//}
|
|
}
|
|
|
|
|
|
private void CdrExportPng(string path, string cdrFile)
|
|
{
|
|
if (!File.Exists(cdrFile))
|
|
{
|
|
Response.Write("找不到文件:"+cdrFile);
|
|
return;
|
|
}
|
|
string fname = path + "\\" + Path.GetFileNameWithoutExtension(cdrFile) + ".png";
|
|
CorelDRAW.Application cdr = new CorelDRAW.Application();
|
|
cdr.OpenDocument(cdrFile, 1);
|
|
object obj = new object();
|
|
Response.Write(Utils.Serialization.JsonString.Convert(cdr.ActiveDocument.ActiveLayer.Shapes[0]));
|
|
return;
|
|
cdr.ActiveDocument.ExportBitmap(
|
|
fname,
|
|
CorelDRAW.cdrFilter.cdrPNG,
|
|
CorelDRAW.cdrExportRange.cdrCurrentPage,
|
|
CorelDRAW.cdrImageType.cdrRGBColorImage,
|
|
0, 0, 72, 72,
|
|
CorelDRAW.cdrAntiAliasingType.cdrNoAntiAliasing,
|
|
false,
|
|
true,
|
|
true,
|
|
false,
|
|
CorelDRAW.cdrCompressionType.cdrCompressionNone,
|
|
null).Finish();
|
|
cdr.ActiveDocument.Close();
|
|
cdr.Quit();
|
|
}
|
|
|
|
public static string MidStrEx(string sourse, string startstr, string endstr)
|
|
{
|
|
string result = string.Empty;
|
|
int startindex, endindex;
|
|
try
|
|
{
|
|
startindex = sourse.IndexOf(startstr);
|
|
if (startindex == -1)
|
|
return result;
|
|
string tmpstr = sourse.Substring(startindex + startstr.Length);
|
|
endindex = tmpstr.IndexOf(endstr);
|
|
if (endindex == -1)
|
|
return result;
|
|
result = tmpstr.Remove(endindex);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine("MidStrEx Err:" + ex.Message);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
private string formatMemo(object memo)
|
|
{
|
|
string m = memo.ToString();
|
|
m = m.Replace("\\", "").Replace("/", "").Replace(":", "").Replace("*", "").Replace("?", "").Replace("<", "").Replace(">", "").Replace("|", "");
|
|
return m;
|
|
}
|
|
} |