Quantcast
Channel: NPOI
Viewing all 1621 articles
Browse latest View live

New Post: Upgrading NPOI. Need Help.

$
0
0
Windows Server 2008 R2. IIS 7. Visual Studio 2012.

I am using a older version of NPOI. But I am not sure what version or how to tell. However, my current (old) version has there files in my Bin folder:

NPOI.DDF.dll
NPOI.dll
NPOI.HPSF.dll
NPOI.HSSF.dll
NPOI.POIFS.dll
NPOI.Util.dll

Version 2.0 has the files:

ICSharpCode.SharpZipLib.dll
NPOI.dll
NPOI.OOXML.dll
NPOI.OOXML.XML
NPOI.OpenXml4Net.dll
NPOI.OpenXml4Net.XML
NPOI.OpenXmlFormats.dll
NPOI.XML

Do I just replace the old files with these?

Second question. In my VBA code I have:

'Libraries needed for the NPOI Excel worksheet creation
Imports NPOI.HSSF.UserModel
Imports NPOI.HSSF.UserModel.HSSFCellStyle
Imports NPOI.HPSF
Imports NPOI.HSSF.Util
Imports NPOI.POIFS.FileSystem

What do I replace these with using the new version of NPOI?

Is there anything else I need to do to utilize the new version and to remove the old version from my web site?

Thanks for the help.

Created Unassigned: NPOI problem on SetCellFormula with custom formula [13174]

$
0
0
Hello, I have an application that fills with data an excel template .Template has .xlsm format .In template I created vba function called SumByColor when i try to set a cell formula to this function i get :
{"Name 'SumByColor' is completely unknown in the current workbook"}
I set formula like this :
```
sheet.GetRow(rowIndex).GetCell(startPos + 2).SetCellFormula(string.Format("SumByColor($AQ$7,F{0}:AI{0})",rowIndex+1));
```

Commented Unassigned: Buffer overrun while writing a workbook [13159]

$
0
0
Hi,

I'm trying to write an excel using filestream
```
using (FileStream file = new FileStream(selectDest.SelectedPath + @"\Import update LHT.xls", FileMode.Create, FileAccess.Write))
{
wbImport.Write(file);
}
```
and I'm getting this error
```
An unhandled exception of type 'NPOI.Util.RuntimeException' occurred in NPOI.dll

Additional information: Buffer overrun i=111;endIndex=152;writeIndex=43
```

The workbook has only one sheet with about 500 rows so I don't think the size is the problem.

The workbook writing worked until last week and since I keep getting this error and I don't know why.
Comments: ** Comment from web user: tonyqus **

The error is thrown by LittleEndianByteArrayOutputStream class

private void CheckPosition(int i)
{
if (i > _endIndex - _writeIndex)
{
throw new RuntimeException(string.Format(CultureInfo.InvariantCulture, "Buffer overrun i={0};endIndex={1};writeIndex={2}", i, _endIndex, _writeIndex));
}
}

If it used to work, the issue may be caused by the original xls template. I need your complete code and xls file to check what's going on.

New Post: Initialisation of record 0x31 left 4 bytes remaining still to be read.

$
0
0
请把牛人的解决方案贴出来,谢谢。

Commented Unassigned: The style setting problem for xls file [13150]

$
0
0
"OES Ch Input data file.xls" This file is the template Excel
"123.xls" This file is modified by NPOI

The following is the code:

```
public static MemoryStream Export(string tempFilePath)
{
IWorkbook iworkbook = null;
HSSFWorkbook hwb = null;
using (FileStream file = new FileStream(tempFilePath, FileMode.Open, FileAccess.Read))
{
hwb = new HSSFWorkbook(file);
iworkbook = hwb;
}

ICellStyle textWhiteStyle = getWhiteText(hwb);

ISheet sheet1 = iworkbook.GetSheet("OES IAM Raw data");

String dataSql = @"Select
DPP.SN,
DPR.PartNumber,
DPR.PartDescription_EN,
DPR.PartDescription_CN,
DPR.VehicleModel_EN,
DPR.Brand,
MICT.TypeName_EN,
MI.ID as MIID,
MIC.CorporationName_EN,
MPMF.PartsBrand_EN,
MPQ.QualityLongName_EN,
MPMF.ID as MPMFID,
SIL.Time,
DPP.MSRPWZVAT,
DPP.DNPWZVAT,
DPP.Remark
From Data_PartPrice DPP
Left Join Data_PartRequire DPR On DPP.SN = DPR.SN
Left Join Sys_ImportLog SIL On DPP.Informants_CN = SIL.Informants_CN
Left Join Master_IAMInformants MI On SIL.Informants_CN = MI.Informants_CN
Left Join Master_IAMCorpList MIC On Mi.CorporationName_CN = MIC.CorporationName_CN
Left Join Master_IAMCorpType MICT On MIC.TypeName_CN = MICT.TypeName_CN
Left Join Master_PartsManufacturers MPMF On DPP.PartsBrand_CN = MPMF.PartsBrand_CN
Left Join Master_PartsQuality MPQ On DPP.QualityType = MPQ.QualityType
Where SIL.City = '{0}'
Order By DPP.SN";
string citySql = @"Select distinct MC.City_EN,MC.City_CN From Data_PartPrice DPP Left Join Sys_ImportLog SIL On DPP.Informants_CN = SIL.Informants_CN
Left Join Master_City MC On SIL.City = MC.City_CN Where MC.City_EN is not null Order By MC.City_EN";

DataTable cityTable = DbHelperSQL.Query(citySql).Tables[0];

for (int i = 0; i < cityTable.Rows.Count; i++)
{
string cityName = cityTable.Rows[i][0].ToString();
ISheet saveSheet = iworkbook.CloneSheet(1);
iworkbook.SetSheetName(iworkbook.GetSheetIndex(saveSheet), "OES IAM Raw data - " + cityName.ToString());
string useSql = String.Format(dataSql, cityTable.Rows[i][1]);
DataTable dataTable = DbHelperSQL.Query(useSql).Tables[0];
string sn = String.Empty;
int lastUserSN = 0;
int fromIndex = 4;
foreach (DataRow dr in dataTable.Rows)
{
IRow row = saveSheet.CreateRow(fromIndex);

ICell cell = row.CreateCell(1);
if (dr["SN"].ToString() != sn)
{
sn = dr["SN"].ToString();
cell.SetCellValue(sn);
lastUserSN = Convert.ToInt32(sn);
}
else
{
lastUserSN = lastUserSN + 10000;
cell.SetCellValue(lastUserSN.ToString());
}
//cell.CellStyle = textWhiteStyle;

cell = row.CreateCell(2);
cell.SetCellValue("OES/IAM");
//cell.CellStyle = textWhiteStyle;

cell = row.CreateCell(3);
cell.SetCellValue("China - " + cityName);
//cell.CellStyle = textWhiteStyle;

cell = row.CreateCell(4);
cell.SetCellValue(dr["PartNumber"].ToString());
//cell.CellStyle = textWhiteStyle;

cell = row.CreateCell(5);
cell.SetCellValue(dr["PartNumber"].ToString().Replace(" ","").Replace("-",""));
//cell.CellStyle = textWhiteStyle;

cell = row.CreateCell(6);
cell.SetCellValue(dr["PartDescription_EN"].ToString());
//cell.CellStyle = textWhiteStyle;

cell = row.CreateCell(7);
cell.SetCellValue(dr["PartDescription_CN"].ToString());
//cell.CellStyle = textWhiteStyle;

cell = row.CreateCell(8);
cell.SetCellValue(dr["VehicleModel_EN"].ToString());
//cell.CellStyle = textWhiteStyle;

cell = row.CreateCell(9);
cell.SetCellValue(dr["Brand"].ToString());
//cell.CellStyle = textWhiteStyle;

cell = row.CreateCell(10);
cell.SetCellValue(dr["TypeName_EN"].ToString());
//cell.CellStyle = textWhiteStyle;

cell = row.CreateCell(11);
cell.SetCellValue(dr["MIID"].ToString());
//cell.CellStyle = textWhiteStyle;

cell = row.CreateCell(12);
cell.SetCellValue(dr["CorporationName_EN"].ToString());
//cell.CellStyle = textWhiteStyle;

cell = row.CreateCell(13);
cell.SetCellValue(dr["PartsBrand_EN"].ToString());
//cell.CellStyle = textWhiteStyle;

cell = row.CreateCell(14);
cell.SetCellValue(dr["QualityLongName_EN"].ToString());
//cell.CellStyle = textWhiteStyle;

cell = row.CreateCell(15);
cell.SetCellValue(dr["MPMFID"].ToString());
//cell.CellStyle = textWhiteStyle;

//cell = row.CreateCell(16);
//cell.SetCellValue(dr["MPMFID"].ToString());
//cell.CellStyle = textWhiteStyle;

cell = row.CreateCell(16);
cell.SetCellValue(Convert.ToDateTime(dr["Time"]).ToString("yyyy/MM/dd"));
//cell.CellStyle = textWhiteStyle;

//17列 不知道放什么 R

//18列 固定字符
cell = row.CreateCell(18);
cell.SetCellValue("CNY");
//cell.CellStyle = textWhiteStyle;

//19列 不知道放什么

cell = row.CreateCell(20);
cell.SetCellValue(dr["MSRPWZVAT"].ToString());
//cell.CellStyle = textWhiteStyle;

cell = row.CreateCell(21);
cell.SetCellValue(dr["DNPWZVAT"].ToString());
//cell.CellStyle = textWhiteStyle;

cell = row.CreateCell(22);
cell.CellFormula = String.Format("U{0}/R{1}", fromIndex + 1, fromIndex + 1);
//cell.CellStyle = textWhiteStyle;

cell = row.CreateCell(23);
cell.CellFormula = String.Format("V{0}/R{1}", fromIndex + 1, fromIndex + 1);
//cell.CellStyle = textWhiteStyle;

cell = row.CreateCell(24);
cell.SetCellValue(dr["Remark"].ToString());
//cell.CellStyle = textWhiteStyle;

fromIndex++;
}
}

iworkbook.RemoveSheetAt(1);

MemoryStream memFile = new MemoryStream();
iworkbook.Write(memFile);

FileStream file1 = new FileStream(@"C:/123.xls", FileMode.Create);
iworkbook.Write(file1);
file1.Close();

//C1.C1Excel.C1XLBook book = new C1.C1Excel.C1XLBook();
//book.Load(@"C:/123.xls", C1.C1Excel.FileFormat.OpaqueBiff8, true);
//book.Sheets[0].GetCell(0, 0).Style.BorderColorBottom = Color.Black;
//book.Save(@"C:/123.xls", C1.C1Excel.FileFormat.OpaqueBiff8);


return memFile;
}

private static ICellStyle getWhiteText(HSSFWorkbook hwb)
{
IFont font1 = hwb.CreateFont();
font1.FontHeightInPoints = 9;
font1.FontName = "Arial Narrow";

ICellStyle style2 = hwb.CreateCellStyle();
style2.SetFont(font1);
style2.BorderBottom = BorderStyle.Thin;
style2.BorderLeft = BorderStyle.Thin;
style2.BorderRight = BorderStyle.Thin;
style2.BorderTop = BorderStyle.Thin;
style2.BottomBorderColor = NPOI.HSSF.Util.HSSFColor.Black.Index;
style2.LeftBorderColor = NPOI.HSSF.Util.HSSFColor.Black.Index;
style2.RightBorderColor = NPOI.HSSF.Util.HSSFColor.Black.Index;
style2.TopBorderColor = NPOI.HSSF.Util.HSSFColor.Black.Index;
style2.Alignment = HorizontalAlignment.Left;
style2.WrapText = true;

return style2;
}
```
I found that if it is set style by the NOPI DLL, the template Excel style will be lost. If I do not implement the "getWhiteText" function, it will not be lost.

Please help me! thanks!
Comments: ** Comment from web user: tonyqus **

不明白你的意思,这函数实现和不实现没道理影响样式。如果NPOI技术支持服务请联系support@neuzilla.com

Edited Issue: SetSheetOrder breaks XLSX [13142]

$
0
0
NPOI 2.1
XSSFWorkbook.cs

Issue:
When setting the sheet order (i.e. moving a worksheet) with XSSF, the XLSX file will break and cannot be opened with Excel.

Reason:
CT_Sheet.Set will set the SheetId of the moved sheet to 0, which the OpenXML format does not allow.

our workaround:
keep the sheetId
```
public void SetSheetOrder(String sheetname, int pos)
{
int idx = GetSheetIndex(sheetname);
XSSFSheet sheet = sheets[idx];
sheets.RemoveAt(idx);
sheets.Insert(pos,sheet);
// Reorder CT_Sheets
CT_Sheets ct = workbook.sheets;
CT_Sheet cts = ct.GetSheetArray(idx).Copy();

// get sheetid from sheet to be moved
uint Mysheetid = ct.GetSheetArray(idx).sheetId;

workbook.sheets.RemoveSheet(idx);
CT_Sheet newcts = ct.InsertNewSheet(pos);
newcts.Set(cts);

// retrieve sheetid
newcts.sheetId = Mysheetid;

//notify sheets
for (int i = 0; i < sheets.Count; i++)
{
sheets[i].sheet = ct.GetSheetArray(i);
}
}
```

Commented Unassigned: NPOI problem on SetCellFormula with custom formula [13174]

$
0
0
Hello, I have an application that fills with data an excel template .Template has .xlsm format .In template I created vba function called SumByColor when i try to set a cell formula to this function i get :
{"Name 'SumByColor' is completely unknown in the current workbook"}
I set formula like this :
```
sheet.GetRow(rowIndex).GetCell(startPos + 2).SetCellFormula(string.Format("SumByColor($AQ$7,F{0}:AI{0})",rowIndex+1));
```
Comments: ** Comment from web user: tonyqus **

custom function defined in VBA is NOT supported by NPOI.

Closed Unassigned: NPOI problem on SetCellFormula with custom formula [13174]

$
0
0
Hello, I have an application that fills with data an excel template .Template has .xlsm format .In template I created vba function called SumByColor when i try to set a cell formula to this function i get :
{"Name 'SumByColor' is completely unknown in the current workbook"}
I set formula like this :
```
sheet.GetRow(rowIndex).GetCell(startPos + 2).SetCellFormula(string.Format("SumByColor($AQ$7,F{0}:AI{0})",rowIndex+1));
```

New Post: Initialisation of record 0x31 left 4 bytes remaining still to be read.

New Post: Upgrading NPOI. Need Help.

$
0
0
After replacement with the new version, you have to change some code because interfaces are changed.

Commented Unassigned: Buffer overrun while writing a workbook [13159]

$
0
0
Hi,

I'm trying to write an excel using filestream
```
using (FileStream file = new FileStream(selectDest.SelectedPath + @"\Import update LHT.xls", FileMode.Create, FileAccess.Write))
{
wbImport.Write(file);
}
```
and I'm getting this error
```
An unhandled exception of type 'NPOI.Util.RuntimeException' occurred in NPOI.dll

Additional information: Buffer overrun i=111;endIndex=152;writeIndex=43
```

The workbook has only one sheet with about 500 rows so I don't think the size is the problem.

The workbook writing worked until last week and since I keep getting this error and I don't know why.
Comments: ** Comment from web user: bogzas **

Hi,

You are right, the issue is the xls file because it was created badly as an export from another application.

Thank you!

New Post: Need Help in creating a Bar Graph Chart Using NPOI

$
0
0
I have been trying to find examples to create a bar graph chart using a datatable . As this is my first with NPOI it would be helpful if the code is in detail.

Created Issue: Adding more than one chart to worksheet results in corrupt .XLSX file [13181]

$
0
0
I am trying to create an Excel worksheet containing multiple charts. However, when I add a second chart the resulting .XLSX file is corrupt when I try opening it.

Here is a code sample that shows the issue (modified from the LineChart example):

```
static void Main(string[] args)
{
int NUM_OF_CHARTS = 2;

IWorkbook wb = new XSSFWorkbook();
ISheet sheet = wb.CreateSheet("linechart");

IDrawing drawing = sheet.CreateDrawingPatriarch();

for (int i = 0; i < NUM_OF_CHARTS; i++)
{
CreateChart(sheet, drawing, i);
}

using (FileStream fs = File.Create(String.Format("test-{0} charts-{1}.xlsx", NUM_OF_CHARTS, DateTime.Now.Ticks)))
{
wb.Write(fs);
}
}

static IChart CreateChart(ISheet sheet, IDrawing drawing, int factor)
{
int NUM_OF_ROWS = 3;
int NUM_OF_COLUMNS = 10;

Random r = new Random((int)DateTime.Now.Ticks);

System.Threading.Thread.Sleep(r.Next(50, 100));

// Create a row and put some cells in it. Rows are 0 based.
IRow row;
ICell cell;
for (int rowIndex = 0 + (NUM_OF_ROWS * factor); rowIndex < NUM_OF_ROWS * (1 + factor); rowIndex++)
{
row = sheet.CreateRow((short)rowIndex);
for (int colIndex = 0; colIndex < NUM_OF_COLUMNS; colIndex++)
{
cell = row.CreateCell((short)colIndex);
if (rowIndex == 0 + NUM_OF_ROWS * factor)
{
cell.SetCellValue(colIndex);
}
else
{
cell.SetCellValue(r.Next(0,100));
}
}
}

IClientAnchor anchor = drawing.CreateAnchor(0, 0, 0, 0, 10, 0 + (10 * factor), 20, 10 + (10 * factor));

IChart chart = drawing.CreateChart(anchor);
ILineChartData<double, double> data = chart.GetChartDataFactory().CreateLineChartData<double, double>();

// Use a category axis for the bottom axis.
IChartAxis bottomAxis = chart.GetChartAxisFactory().CreateCategoryAxis(AxisPosition.Bottom);
IValueAxis leftAxis = chart.GetChartAxisFactory().CreateValueAxis(AxisPosition.Left);

IChartDataSource<double> xs = DataSources.FromNumericCellRange(sheet, new CellRangeAddress(0 + factor * NUM_OF_ROWS, 0 + factor * NUM_OF_ROWS, 0, NUM_OF_COLUMNS - 1));
IChartDataSource<double> ys1 = DataSources.FromNumericCellRange(sheet, new CellRangeAddress(1 + factor * NUM_OF_ROWS, 1 + factor * NUM_OF_ROWS, 0, NUM_OF_COLUMNS - 1));
IChartDataSource<double> ys2 = DataSources.FromNumericCellRange(sheet, new CellRangeAddress(2 + factor * NUM_OF_ROWS, 2 + factor * NUM_OF_ROWS, 0, NUM_OF_COLUMNS - 1));

var s1 = data.AddSerie(xs, ys1);
s1.SetTitle("title1");
var s2 = data.AddSerie(xs, ys2);
s2.SetTitle("title2");

chart.Plot(data, bottomAxis, leftAxis);

return chart;
}
```




Any ideas?

New Post: Adding more than one chart to worksheet results in corrupt .XLSX file

$
0
0
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.

New Post: Need Help in creating a Bar Graph Chart Using NPOI

$
0
0
Bar graph is not supported for now.

Commented Issue: [Bug] Broken named ranges after existing file modification [13165]

$
0
0
I tried to open existing xlsx file (from excel 2007) and alter named ranges (can be specified in excel in Formulas/Name manager).

Problem is that when file is saved, all names' scope is changed to Sheet instead of whole Workbook. It breaks existing expressions.

Primary issue seems to be in CT_DefinedName class, Parse method is setting fields
ctObj.localSheetId = XmlHelper.ReadUInt(node.Attributes["localSheetId"]);
ctObj.localSheetIdFieldSpecified = node.Attributes["localSheetId"] != null;

while Write method always set localSheedId even if it was not originally present - it causes that field is set to 0 and scope is set to 1st sheet instead of workbook. There should be some check if localSheetIdFieldSpecified is set.
XmlHelper.WriteAttribute(sw, "localSheetId", this.localSheetId, true);


Btw, another bug is that expression "=SHEET_NAME!defined_name" cannot be parsed by NPOI, it fails with error that reference is expected. Expression "=defined_name" works but I cannot use it as it works with global scope names only.
Comments: ** Comment from web user: tonyqus **

This will be fixed in new release

Commented Unassigned: EXCEL 2013 - Date Format from row 10 [13144]

$
0
0
Hi, I'm using the NPOI 2.0 Version of your library, and I'm having an issue when creating an Excel file and try to open with Microsoft Excel 2013.

There is a column with date format, that works fine from row 1 to 10, but from row 11 the program stops reading this property and shows a weird decima value.

The llibrary works perfect for me in older versions of Excel, OpenOffice and GoogleDrive.

I attach a screenshot.

Thanks and regards!

Alejo
Comments: ** Comment from web user: applepie89 **

I'm experiencing the same sort of problems..

I generate a file and if I open this file in Excel 2010, everything looks fine, just the way I want it, and if someone runs the program and opens the generated file in Excel 2010, the table looks fine from row 1 to 10, after row 10 the style isn't applied anymore.

I also attached a screenshot

Commented Unassigned: EXCEL 2013 - Date Format from row 10 [13144]

$
0
0
Hi, I'm using the NPOI 2.0 Version of your library, and I'm having an issue when creating an Excel file and try to open with Microsoft Excel 2013.

There is a column with date format, that works fine from row 1 to 10, but from row 11 the program stops reading this property and shows a weird decima value.

The llibrary works perfect for me in older versions of Excel, OpenOffice and GoogleDrive.

I attach a screenshot.

Thanks and regards!

Alejo
Comments: ** Comment from web user: applepie89 **

for additional information, I use this code to apply the style:

First I Defined the style I want to apply:
```
HSSFFont fontStyleSubject = (HSSFFont)xlsWorkbook.CreateFont();
fontStyleSubject.Boldweight = (short)FontBoldWeight.BOLD;
ICellStyle cellStyleSubject = xlsWorkbook.CreateCellStyle();
cellStyleSubject.SetFont(fontStyleSubject);
short colorIndex = new HSSFColor.GREY_25_PERCENT().GetIndex();
cellStyleSubject.FillForegroundColor = colorIndex;
cellStyleSubject.FillPattern = FillPatternType.SOLID_FOREGROUND;
```

after that, I have the following:
```
if (cellIsHeader)
{
wbCell.SetCellValue(cellValue);
wbCell.CellStyle = cellStyleSubject;
}
```

the strange thing is, as you can see in the attachment (difference), I also have a borderstyle, and this behaves correctly on all the rows as you can see, the code for this is nothing more then:

defining the style:
```
ICellStyle borderStyle = xlsWorkbook.CreateCellStyle();
borderStyle.BorderBottom = BorderStyle.THIN;
borderStyle.BorderRight = BorderStyle.THIN;
```

and if none of the if/else if's apply on a row, this code is applied:
else
```
{
wbCell.CellStyle = borderStyle;
}
```

Created Unassigned: Missing Rows in XSSFWorkbook [13193]

$
0
0
I'm using npoi 2.0.6.0 with .net 4.5.

I'm trying to load and parse a spreadsheet that is publicly available on the internet on the web page http://www.directedge.com/MarketData/SecuritiesTraded.aspx .

The file is the "EDGA Securities Traded" - I've attached the original spreadsheet and another spreadsheet that indicates the missing rows. This spreadsheet is liable to change every day, but the direct download link is http://www.directedge.com/Portals/0/02Market%20Data/Securities%20Traded/EDGA%20-%20Tradable%20Symbols.xlsx

I load the spreadsheet like this:

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url); // Same as displayed above
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

using (Stream ResponseStream = response.GetResponseStream())
{
IWorkbook workbook = new XSSFWorkbook(OPCPackage.Open(ResponseStream));

Then, I iterate through the rows:

for (int RowNumber = sheet.FirstRowNum; RowNumber <= sheet.LastRowNum; RowNumber++)
{

This is where the weirdness starts. When the attached spreadsheet is loaded into Excel, the first row is 1 and the last row is 8156 which is 8155 rows. However, in NPOI, the FirstRowNum=0 and the LastRowNum=8147 which is 8148 rows. So seven rows are missing. I've determined the missing rows are:

RowNum Column A Column B
[3393] HIH HELIOS HIGH INCOME FUND INC
[3421] HMH HELIOS MULTI-SECTOR HI INCM FD
[3480] HSA HELIOS STRATEGIC INCOME FUND
[4542] MCLB MICROLIN BIO, INC
[4543] MCLBW MICROLIN BIO, INC
[4898] MTY CITIGROUP FDG INC 8/11/14
[4909] MUK CITIGROUP FDG INC 8/11/14

Can someone tell me why they appear to be missing?

Commented Unassigned: Missing Rows in XSSFWorkbook [13193]

$
0
0
I'm using npoi 2.0.6.0 with .net 4.5.

I'm trying to load and parse a spreadsheet that is publicly available on the internet on the web page http://www.directedge.com/MarketData/SecuritiesTraded.aspx .

The file is the "EDGA Securities Traded" - I've attached the original spreadsheet and another spreadsheet that indicates the missing rows. This spreadsheet is liable to change every day, but the direct download link is http://www.directedge.com/Portals/0/02Market%20Data/Securities%20Traded/EDGA%20-%20Tradable%20Symbols.xlsx

I load the spreadsheet like this:

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url); // Same as displayed above
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

using (Stream ResponseStream = response.GetResponseStream())
{
IWorkbook workbook = new XSSFWorkbook(OPCPackage.Open(ResponseStream));

Then, I iterate through the rows:

for (int RowNumber = sheet.FirstRowNum; RowNumber <= sheet.LastRowNum; RowNumber++)
{

This is where the weirdness starts. When the attached spreadsheet is loaded into Excel, the first row is 1 and the last row is 8156 which is 8155 rows. However, in NPOI, the FirstRowNum=0 and the LastRowNum=8147 which is 8148 rows. So seven rows are missing. I've determined the missing rows are:

RowNum Column A Column B
[3393] HIH HELIOS HIGH INCOME FUND INC
[3421] HMH HELIOS MULTI-SECTOR HI INCM FD
[3480] HSA HELIOS STRATEGIC INCOME FUND
[4542] MCLB MICROLIN BIO, INC
[4543] MCLBW MICROLIN BIO, INC
[4898] MTY CITIGROUP FDG INC 8/11/14
[4909] MUK CITIGROUP FDG INC 8/11/14

Can someone tell me why they appear to be missing?
Comments: ** Comment from web user: sevzas **

attached original file

Viewing all 1621 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>