- Excel 저장
- MaterialSkin 제거
This commit is contained in:
2
ConfigForm.Designer.cs
generated
2
ConfigForm.Designer.cs
generated
@@ -584,7 +584,7 @@
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(132, 12);
|
||||
this.label9.TabIndex = 20;
|
||||
this.label9.Text = "Version : 2017.01.31.15";
|
||||
this.label9.Text = "Version : 2017.02.01.11";
|
||||
//
|
||||
// ConfigForm
|
||||
//
|
||||
|
||||
142
ExcelHandler.cs
142
ExcelHandler.cs
@@ -7,11 +7,15 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
//using Excel = Microsoft.Office.Interop.Excel;
|
||||
using System.Reflection;
|
||||
|
||||
using OfficeOpenXml;
|
||||
using System.Drawing;
|
||||
using OfficeOpenXml.Style;
|
||||
|
||||
namespace NewsCrawler
|
||||
{
|
||||
public class ExcelHandler
|
||||
{
|
||||
bool m_bAvailable = true;
|
||||
string m_strFileName = "";
|
||||
string m_strToday = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
|
||||
@@ -20,52 +24,26 @@ namespace NewsCrawler
|
||||
m_strFileName = strFileName;
|
||||
}
|
||||
|
||||
public bool IsAvailable()
|
||||
{
|
||||
return m_bAvailable;
|
||||
}
|
||||
|
||||
private void Create()
|
||||
{
|
||||
//try
|
||||
//{
|
||||
// Excel.Application App = new Excel.Application();
|
||||
// if(App == null)
|
||||
// {
|
||||
// Util.Log(Util.LOG_TYPE.ERROR, "엑셀이 설치되지 않음");
|
||||
// m_bAvailable = false;
|
||||
// return;
|
||||
// }
|
||||
FileInfo newFile = new FileInfo(m_strFileName);
|
||||
ExcelPackage package = new ExcelPackage(newFile);
|
||||
ExcelWorksheet Sheet = package.Workbook.Worksheets.Add("first");
|
||||
Sheet.Cells[1, 1].Value = "날짜";
|
||||
Sheet.Cells[1, 2].Value = "기사 시간";
|
||||
Sheet.Cells[1, 3].Value = "받은 시간";
|
||||
Sheet.Cells[1, 4].Value = "요청 시간";
|
||||
Sheet.Cells[1, 5].Value = "출처";
|
||||
Sheet.Cells[1, 6].Value = "제목";
|
||||
Sheet.Cells[1, 7].Value = "종목명";
|
||||
Sheet.Cells[1, 8].Value = "시가";
|
||||
Sheet.Cells[1, 9].Value = "저가";
|
||||
Sheet.Cells[1, 10].Value = "대비";
|
||||
Sheet.Cells[1, 11].Value = "고가";
|
||||
Sheet.Cells[1, 12].Value = "대비";
|
||||
Sheet.Cells[1, 13].Value = "링크";
|
||||
|
||||
// Excel._Workbook Workbook = App.Workbooks.Add(Missing.Value);
|
||||
// Excel._Worksheet Worksheet = Workbook.ActiveSheet;
|
||||
|
||||
// Worksheet.Cells[1, 1] = "날짜";
|
||||
// Worksheet.Cells[1, 2] = "기사 시간";
|
||||
// Worksheet.Cells[1, 3] = "받은 시간";
|
||||
// Worksheet.Cells[1, 4] = "출처";
|
||||
// Worksheet.Cells[1, 5] = "제목";
|
||||
// Worksheet.Cells[1, 6] = "요청 시간";
|
||||
// Worksheet.Cells[1, 7] = "시가";
|
||||
// Worksheet.Cells[1, 8] = "저가";
|
||||
// Worksheet.Cells[1, 9] = "대비";
|
||||
// Worksheet.Cells[1, 10] = "고가";
|
||||
// Worksheet.Cells[1, 11] = "대비";
|
||||
// Worksheet.Cells[1, 12] = "링크";
|
||||
|
||||
// Workbook.SaveAs(m_strFileName, Excel.XlFileFormat.xlOpenXMLWorkbook, Missing.Value,
|
||||
// Missing.Value, false, false, Excel.XlSaveAsAccessMode.xlNoChange,
|
||||
// Excel.XlSaveConflictResolution.xlUserResolution, true,
|
||||
// Missing.Value, Missing.Value, Missing.Value);
|
||||
// Workbook.Close();
|
||||
//}
|
||||
//catch(Exception ex)
|
||||
//{
|
||||
// Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
|
||||
//}
|
||||
|
||||
string strMessage = "날짜, 기사 시간, 받은 시간, 요청 시간, 출처, 제목, 종목명, 시가, 저가, 대비, 고가, 대비, 링크";
|
||||
File.AppendAllText(m_strFileName, strMessage+Environment.NewLine, new UTF8Encoding(true));
|
||||
package.Save();
|
||||
}
|
||||
|
||||
public bool AddRow(string strNewsTime, string strResTime, float fReqTime, string strRef, string strTitle, string strCodeName,
|
||||
@@ -73,53 +51,43 @@ namespace NewsCrawler
|
||||
{
|
||||
lock(this)
|
||||
{
|
||||
if(m_bAvailable == false)
|
||||
return false;
|
||||
|
||||
if(File.Exists(m_strFileName) == false)
|
||||
Create();
|
||||
|
||||
string strMessage = string.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7:n0}, {8:n0}, {9:n2}, {10:n0}, {11:n2}, {12}",
|
||||
m_strToday, strNewsTime, strResTime, fReqTime, strRef, strTitle.Replace(",", "\\,"), strCodeName,
|
||||
iPriceS, iPriceLow, fPriceLowP, iPriceHigh, fPriceHighP, strLink);
|
||||
File.AppendAllText(m_strFileName, strMessage+Environment.NewLine, new UTF8Encoding(true));
|
||||
FileInfo newFile = new FileInfo(m_strFileName);
|
||||
ExcelPackage package = new ExcelPackage(newFile);
|
||||
ExcelWorksheet Sheet = package.Workbook.Worksheets["first"];
|
||||
int iRow = Sheet.Dimension.Rows+1;
|
||||
Sheet.Cells[iRow, 1].Value = m_strToday;
|
||||
Sheet.Cells[iRow, 2].Value = strNewsTime;
|
||||
Sheet.Cells[iRow, 3].Value = strResTime;
|
||||
Sheet.Cells[iRow, 4].Value = fReqTime;
|
||||
Sheet.Cells[iRow, 5].Value = strRef;
|
||||
Sheet.Cells[iRow, 6].Value = strTitle;
|
||||
Sheet.Cells[iRow, 7].Value = strCodeName;
|
||||
Sheet.Cells[iRow, 8].Value = iPriceS;
|
||||
Sheet.Cells[iRow, 8].Style.Numberformat.Format = "###,###,##0";
|
||||
Sheet.Cells[iRow, 9].Value = iPriceLow;
|
||||
Sheet.Cells[iRow, 9].Style.Numberformat.Format = "###,###,##0";
|
||||
Sheet.Cells[iRow, 10].Value = fPriceLowP;
|
||||
Sheet.Cells[iRow, 10].Style.Numberformat.Format = "###,###,##0.00";
|
||||
if(fPriceLowP > 0)
|
||||
Sheet.Cells[iRow, 10].Style.Font.Color.SetColor(Color.Red);
|
||||
else if(fPriceLowP < 0)
|
||||
Sheet.Cells[iRow, 10].Style.Font.Color.SetColor(Color.Blue);
|
||||
Sheet.Cells[iRow, 11].Value = iPriceHigh;
|
||||
Sheet.Cells[iRow, 11].Style.Numberformat.Format = "###,###,##0";
|
||||
Sheet.Cells[iRow, 12].Value = fPriceHighP;
|
||||
Sheet.Cells[iRow, 12].Style.Numberformat.Format = "###,###,##0.00";
|
||||
if(fPriceHighP > 0)
|
||||
Sheet.Cells[iRow, 12].Style.Font.Color.SetColor(Color.Red);
|
||||
else if(fPriceHighP < 0)
|
||||
Sheet.Cells[iRow, 12].Style.Font.Color.SetColor(Color.Blue);
|
||||
Sheet.Cells[iRow, 13].Value = strLink;
|
||||
|
||||
|
||||
//try
|
||||
//{
|
||||
// Excel.Application App = new Excel.Application();
|
||||
// if(App == null)
|
||||
// {
|
||||
// Util.Log(Util.LOG_TYPE.ERROR, "엑셀이 설치되지 않음");
|
||||
// m_bAvailable = false;
|
||||
// return false;
|
||||
// }
|
||||
// App.DisplayAlerts = false;
|
||||
|
||||
// Excel._Workbook Workbook = App.Workbooks.Open(m_strFileName);
|
||||
// Excel._Worksheet Worksheet = Workbook.ActiveSheet;
|
||||
|
||||
// int iRow = Worksheet.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell, Type.Missing).Row+1;
|
||||
// Worksheet.Cells[iRow, 1] = m_strToday;
|
||||
// Worksheet.Cells[iRow, 2] = strNewsTime;
|
||||
// Worksheet.Cells[iRow, 3] = strResTime;
|
||||
// Worksheet.Cells[iRow, 4] = strRef;
|
||||
// Worksheet.Cells[iRow, 5] = strTitle;
|
||||
// Worksheet.Cells[iRow, 6] = fReqTime;
|
||||
// Worksheet.Cells[iRow, 7] = iPriceS;
|
||||
// Worksheet.Cells[iRow, 8] = iPriceLow;
|
||||
// Worksheet.Cells[iRow, 9] = fPriceLowP;
|
||||
// Worksheet.Cells[iRow, 10] = iPriceHigh;
|
||||
// Worksheet.Cells[iRow, 11] = fPriceHighP;
|
||||
// Worksheet.Cells[iRow, 12] = strLink;
|
||||
|
||||
// Workbook.Save();
|
||||
// Workbook.Close();
|
||||
//}
|
||||
//catch(Exception ex)
|
||||
//{
|
||||
// Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
|
||||
// return false;
|
||||
//}
|
||||
Sheet.Cells.AutoFitColumns(0);
|
||||
package.Save();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -71,12 +71,13 @@
|
||||
<ApplicationIcon>icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EPPlus, Version=4.1.0.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL">
|
||||
<HintPath>packages\EPPlus.4.1.0\lib\net40\EPPlus.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="HtmlAgilityPack">
|
||||
<HintPath>HtmlAgility\HtmlAgilityPack.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MaterialSkin">
|
||||
<HintPath>..\AutoSeller\packages\MaterialSkin.0.2.1\lib\MaterialSkin.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
|
||||
10
NewsForm.Designer.cs
generated
10
NewsForm.Designer.cs
generated
@@ -43,7 +43,6 @@
|
||||
this.btnConfig = new System.Windows.Forms.Button();
|
||||
this.chBuy = new System.Windows.Forms.CheckBox();
|
||||
this.cbPriceCheck = new System.Windows.Forms.CheckBox();
|
||||
this.materialContextMenuStrip1 = new MaterialSkin.Controls.MaterialContextMenuStrip();
|
||||
this.lvList = new NewsCrawler.ListViewNF();
|
||||
this.chId = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chTime = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
@@ -214,14 +213,6 @@
|
||||
this.cbPriceCheck.Text = "가격 체크";
|
||||
this.cbPriceCheck.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// materialContextMenuStrip1
|
||||
//
|
||||
this.materialContextMenuStrip1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
this.materialContextMenuStrip1.Depth = 0;
|
||||
this.materialContextMenuStrip1.MouseState = MaterialSkin.MouseState.HOVER;
|
||||
this.materialContextMenuStrip1.Name = "materialContextMenuStrip1";
|
||||
this.materialContextMenuStrip1.Size = new System.Drawing.Size(61, 4);
|
||||
//
|
||||
// lvList
|
||||
//
|
||||
this.lvList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
@@ -374,7 +365,6 @@
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel3;
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel4;
|
||||
private System.Windows.Forms.ColumnHeader chCodeName;
|
||||
private MaterialSkin.Controls.MaterialContextMenuStrip materialContextMenuStrip1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace NewsCrawler
|
||||
// col.Width = -2;
|
||||
//}
|
||||
|
||||
m_Excel = new ExcelHandler(Util.GetLogPath()+"/PriceCheck"+DateTime.Now.ToString("yyyy-MM-dd")+".csv");
|
||||
m_Excel = new ExcelHandler(Util.GetLogPath()+"/PriceCheck-"+DateTime.Now.ToString("yyyy-MM-dd")+".xlsx");
|
||||
|
||||
m_CrawlTimer.Elapsed+=CrawlTimer_Tick;
|
||||
m_CrawlTimer.Interval = m_iCrawlInterval;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="EPPlus" version="4.1.0" targetFramework="net452" />
|
||||
<package id="Microsoft.Office.Interop.Excel" version="15.0.4795.1000" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
|
||||
</packages>
|
||||
BIN
packages/EPPlus.4.1.0/EPPlus.4.1.0.nupkg
vendored
Normal file
BIN
packages/EPPlus.4.1.0/EPPlus.4.1.0.nupkg
vendored
Normal file
Binary file not shown.
32621
packages/EPPlus.4.1.0/lib/net35/EPPlus.XML
vendored
Normal file
32621
packages/EPPlus.4.1.0/lib/net35/EPPlus.XML
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/EPPlus.4.1.0/lib/net35/EPPlus.dll
vendored
Normal file
BIN
packages/EPPlus.4.1.0/lib/net35/EPPlus.dll
vendored
Normal file
Binary file not shown.
32621
packages/EPPlus.4.1.0/lib/net40/EPPlus.XML
vendored
Normal file
32621
packages/EPPlus.4.1.0/lib/net40/EPPlus.XML
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/EPPlus.4.1.0/lib/net40/EPPlus.dll
vendored
Normal file
BIN
packages/EPPlus.4.1.0/lib/net40/EPPlus.dll
vendored
Normal file
Binary file not shown.
122
packages/EPPlus.4.1.0/lib/readme.txt
vendored
Normal file
122
packages/EPPlus.4.1.0/lib/readme.txt
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
EPPlus 4.1
|
||||
|
||||
Visit epplus.codeplex.com for the latest information
|
||||
|
||||
EPPlus-Create Advanced Excel spreadsheet.
|
||||
|
||||
New features 4.0
|
||||
|
||||
Replaced Packaging API with DotNetZip
|
||||
* This will remove any problems with Isolated Storage and enable multithreading
|
||||
|
||||
|
||||
New Cell store
|
||||
* Less memory consumption
|
||||
* Insert columns (not on the range level)
|
||||
* Faster row inserts,
|
||||
|
||||
Formula Parser
|
||||
* Calculates all formulas in a workbook, a worksheet or in a specified range
|
||||
* 100+ functions implemented
|
||||
* Access via Calculate methods on Workbook, Worksheet and Range objects.
|
||||
* Add custom/missing Excel functions via Workbook. FormulaParserManager.
|
||||
* Samples added to the EPPlusSamples project.
|
||||
|
||||
The formula parser does not support Array Formulas
|
||||
* Intersect operator (Space)
|
||||
* References to external workbooks
|
||||
* And probably a whole lot of other stuff as well :)
|
||||
|
||||
Performance
|
||||
*Of course the performance of the formula parser is nowhere near Excels. Our focus has been functionality.
|
||||
|
||||
Agile Encryption (Office 2012-)
|
||||
* Support for newer type of encryption.
|
||||
|
||||
Minor new features
|
||||
* Chart worksheets
|
||||
* New Chart Types Bubblecharts
|
||||
* Radar Charts
|
||||
* Area Charts
|
||||
* And lots of bug fixes...
|
||||
|
||||
Beta 2 Changes
|
||||
* Fixed bug when using RepeatColumns & RepeatRows at the same time.
|
||||
* VBA project will be left untouched if it’s not accessed.
|
||||
* Fixed problem with strings on save.
|
||||
* Added locks to the cell store for access by multiple threads.
|
||||
* Implemented Indirect function
|
||||
* Used DisplayNameAttribute to generate column headers from LoadFromCollection
|
||||
* Rewrote ExcelRangeBase.Copy function.
|
||||
* Added caching to Save ZipStream for Cells and shared strings to speed up the Save method.
|
||||
* Added Missing InsertColumn and DeleteColumn
|
||||
* Added pull request to support Date1904
|
||||
* Added pull request ExcelWorksheet. LoadFromDataReader
|
||||
|
||||
Release Candidate changes
|
||||
* Fixed some problems with Range.Copy Function
|
||||
* InsertColumn and Delete column didn't work in some cases
|
||||
* Chart.DisplayBlankAs had the wrong default type in Excel 2010+
|
||||
* Datavalidation list overflow caused corruption of the package
|
||||
* Fixed a few Calculation when referring ranges (for example If function)
|
||||
* Added ChartAxis.DisplayUnit
|
||||
* Fixed a bug related to shared formulas
|
||||
* Named styles failed in some cases.
|
||||
* Style.Indent got an invalid value in some cases.
|
||||
* Fixed a problem with AutofitColumns method.
|
||||
* Performance fix.
|
||||
* A whole lot of other small fixes.
|
||||
|
||||
4.0.1 Fixes
|
||||
* VBA unreadable content
|
||||
* Fixed a few issues with InsertRow and DeleteRow
|
||||
* Fixed bug in Average and AverageA
|
||||
* Handling of Div/0 in functions
|
||||
* Fixed VBA CodeModule error when copying a worksheet.
|
||||
* Value decoding when reading str element for cell value.
|
||||
* Better exception when accessing a worksheet out of range in the Excelworksheets indexer.
|
||||
* Added Small and Large function to formula parser. Performance fix when encountering an unknown function.
|
||||
* Fixed handling strings in formulas
|
||||
* Calculate hangs if formula start with a parenthes.
|
||||
* Worksheet.Dimension returned an invalid range in some cases.
|
||||
* Rowheight was wrong in some cases.
|
||||
* ExcelSeries.Header had an incorrect validation check.
|
||||
|
||||
4.0.2 Fixes
|
||||
* Fixes a whole bunch of bugs related to the cell store (Worksheet.InsertColumn, Worksheet.InsertRow, Worksheet.DeleteColumn, Worksheet.DeleteRow, Range.Copy, Range.Clear)
|
||||
* Added functions Acos, Acosh, Asinh, Atanh, Atan, CountBlank, CountIfs, Mina, Offset, Median, Hyperlink, Rept
|
||||
* Fix for reading Excel comment content from the t-element.
|
||||
* Fix to make Range.LoadFromCollection work better with inheritence
|
||||
* And alot of other small fixes
|
||||
|
||||
4.0.3 Fixes
|
||||
* Added compilation directive for MONO (Thanks Danny)
|
||||
* Added functions IfError, Char, Error.Type, Degrees, Fixed, IsNonText, IfNa and SumIfs
|
||||
* And fixed a lot of issues. See http://epplus.codeplex.com/SourceControl/list/changesets for more details
|
||||
|
||||
4.0.4 Fixes
|
||||
* Added functions Daverage, Dvar Dvarp, DMax, DMin DSum, DGet, DCount and DCountA
|
||||
* Exposed the formula parser logging functionality via FormulaParserManager.
|
||||
* And fixed a lot of issues. See http://epplus.codeplex.com/SourceControl/list/changesets for more details
|
||||
|
||||
4.0.5 Fixes
|
||||
* Switched to Visual Studio 2015 for code and sample projects.
|
||||
* Added LineColor, MarkerSize, LineWidth and MarkerLineColor properties to line charts
|
||||
* Added LineEnd properties to shapes
|
||||
* Added functions Value, DateValue, TimeValue
|
||||
* Removed WPF depedency.
|
||||
* And fixed a lot of issues. See http://epplus.codeplex.com/SourceControl/list/changesets for more details
|
||||
|
||||
4.1
|
||||
* Added functions Rank, Rank.eq, Rank.avg and Search
|
||||
* Custom function compilers can now be added via FormulaParserManager
|
||||
* Applied a whole bunch of pull requests...
|
||||
* Performance and memory usage tweeks
|
||||
* Ability to set and retrieve 'custom' extended application propeties.
|
||||
* Added style QuotePrefix
|
||||
* Added support for MajorTimeUnit and MinorTimeUnit to chart axes
|
||||
* Added GapWidth Property to BarChart and Gapwidth.
|
||||
* Added Fill and Border properties to ChartSerie.
|
||||
* Added support for MajorTimeUnit and MinorTimeUnit to chart axes
|
||||
* Insert/delete row/column now shifts named ranges, comments, tables and pivottables.
|
||||
* And fixed a lot of issues. See http://epplus.codeplex.com/SourceControl/list/changesets for more details
|
||||
Reference in New Issue
Block a user