Quantcast
Channel: npoi Discussions Rss Feed
Viewing all 637 articles
Browse latest View live

New Post: Excel found unreadable content in filename.xls

$
0
0
Hi!
I'm experiencing the same issue, with example "ScatterChart" excel 2010.

Here is link on result file.

Is there any workaround?

New Post: Excel found unreadable content in filename.xls

$
0
0
Yes, thekg, there is a workaround.

The worksheet XML that is being written has the wrong decimal separator ("," instead of "."). (Unzip the xlsx and find the xl\worksheets\worksheet1.xml file, find the pagemargin info)

Seems like your Windows on a locale other than EN. As is mentioned in the post here, setting your culture info to EN... before writing the xml streams will make sure that all decimal numbers are being written in the correct format, i.e. with a "." as a decimal separator.

@tonyqus:
Is there another way to make sure the XML is being written correctly on any international system? Not many countries use "." as a decimal separator.

New Post: Excel found unreadable content in filename.xls

$
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: Newb questions

$
0
0
Hello

As a newcomer to this project I have some very fundamental questions. I use NPOI version 2.0 RC and have also downloaded source code version 2.0.6RC1

0- My most intensive problem right now is that WorkBook.GetSheetAt(i).TabColorIndex returns null reference exception. Although learning the basics is important for me, before that I need to proceed with my project and overcome this obstacle.

1- What is the usage of different namesapces DDF, HPSF, HSSF, POISF, SS, Util? I can't find any reference about them.

2- I've read somewhere on net about namespace XSSF (xlsx files) but it is not included in my project. where ca I get it?

3- Why HSSFWorkbook returns sheets of type ISheet? how is it to get HSSFSheet? or if it is not possible to get it, why is it here? Is there any third or even fourth parallel object model?

4- Could you please help how to include source code in a project instead of binaries? which files shall be copied to project? Is source code version 2.0.6RC1 an stable version?

This many of questions is only because I can't find correct reference document. I wish I could find it and ask less questions!

Thanks in advance

New Post: Write to XLSX file issue

$
0
0
I have an existing excel file (2007) to write to. I open it like in c#
            using (FileStream file = new FileStream(bestand, FileMode.Open, FileAccess.ReadWrite))
            {
                wb1 = new XSSFWorkbook(file);

             // lots of stuff
             }
wb1.close(file)

get the error: must support writing, BaseOutputstream

New Post: how i can disable protected view in a excel file with NPOI 1.2.5 when i created new file .xls

$
0
0
Hi guys,

when i have a template in XLS and then i create a new file with SSIS component , when i opened the file, it's have a protected view. Is it possible to do it withouth this?

Best regards.

New Post: Write to XLSX file issue

$
0
0
Man, you should create another FileStream for write purpose.

New Post: Write to XLSX file issue

$
0
0
Ok, i have now, but the xlsx file is a mess. Even if I don't add anything to it. Office 2010, libre office and open office can't open.

New Post: AutoSizeColumn got slow in NPOI 2.0

$
0
0
Hello,
I have the same problem with a sheet with only 5 columns and 5000 rows.
Each column take ~1s to resize.

Kind regards, Guillaume

New Post: Bug when deleting then creating a worksheet

$
0
0
Hello,

I have a workbook with 3 worksheets ("Sheet1", "Sheet2", "Sheet3")
If i remove the last one ("Sheet3") and then create a new one nammed "Sheet4", i have the following exception :

An exception of type 'NPOI.OpenXml4Net.Exceptions.PartAlreadyExistsException' occurred in NPOI.OOXML.dll but was not handled in user code

Additional information: A part with the name '/xl/worksheets/sheet3.xml' already exists : Packages shall not contain equivalent part names and package implementers shall neither create nor recognize packages with equivalent part names. [M1.12]


My code :
ISheet s = _workBook.GetSheet("Sheet3");
if (s != null)
{
_workBook.Remove(s);
}
_workBook.CreateSheet("Sheet4");
Am i doing something wrong ?

Kind regards,
Guillaume

New Post: Formula evaluation, matter of precedence of chain of formulas

$
0
0
Hello

I have a question about how NPOI or POI calculates the whole work book.

Assume we have a formula in Sheet1!a2 which uses results of formula in sheet2!c5 wich usese results of formula in sheest1!b7 and ...

The samples of using evaluateformulacell iterate through all rows and columns one by one. this way is not the same as calculating from the beginning of chain of formulas; in my sample above calculation must start from sheet1!b7, then sheet2!c5 and finally shett1!a2. How is it possible to solve this problem?

I'm using WorkBook.GetCreationHelper().CreateFormulaEvaluator().ClearAllCachedResultValues();
WorkBook.GetCreationHelper().CreateFormulaEvaluator().EvaluateAll();
I'm not sure if this one takes care of my question or not?

Regards

New Post: Print Object

$
0
0
Hi

i have same problem. do u have solution to fix this problem. Pls, tell me??

Thank.

New Post: Print Object

$
0
0
I change the code from

Dim anchor As New XSSFClientAnchor(650, 550, 0, 0, 0, 1, 2, 4)

become

Dim anchor As New HSSFClientAnchor(0, 0, 800, 0, 0, 1, 1, 4)

and problem resolved.

New Post: display a number with thousand separator in Indian style( 12, 12,34,567.89)in the exported excel sheet using program

$
0
0
I am using VS2008,ASP.net,C#.net,NPOI 1.2.3 dll.

I have a web applicaion which uses NPOI dll to export to excel 2003. How do I display a number with thousand separator in Indian style( 12, 12,34,567.89)in the exported excel sheet using program? The built in formula sum() should be applied on these exported cells with number format.

thanks in advance
george n t

The code is mentioned below.

protected void btnGenerateReport_Click(object sender, EventArgs e) { // Get the data to report on //var userAccounts = Membership.GetAllUsers();

// Create a new workbook and a sheet named "User Accounts"
HSSFWorkbook workbook = new HSSFWorkbook();
Sheet sheet = workbook.CreateSheet("User Accounts");
//var sheet = workbook.CreateSheet("User Accounts");

// Add header labels
int rowIndex = 0;
Row row = sheet.CreateRow(rowIndex);
row.CreateCell(0).SetCellValue("Username");
row.CreateCell(1).SetCellValue("Email");
row.CreateCell(2).SetCellValue("Joined");
row.CreateCell(3).SetCellValue("Last Login");
row.CreateCell(4).SetCellValue("Approved?");
row.CreateCell(5).SetCellValue("Qty");
rowIndex++;



//NUMBER FORMAT BEGIN
CellStyle detailCurrencySubtotalCellStyle = workbook.CreateCellStyle();
detailCurrencySubtotalCellStyle.BorderTop = CellBorderType.THIN;
detailCurrencySubtotalCellStyle.BorderBottom = CellBorderType.THIN;
Font detailCurrencySubtotalFont = workbook.CreateFont();
detailCurrencySubtotalFont.Boldweight = (short)FontBoldWeight.BOLD;
detailCurrencySubtotalCellStyle.SetFont(detailCurrencySubtotalFont);
detailCurrencySubtotalCellStyle.DataFormat = HSSFDataFormat.GetBuiltinFormat("##,##,##,##0.00");

//NUMBER FORMAT END

row = sheet.CreateRow(rowIndex);
row.CreateCell(0).SetCellValue("preejo");
row.CreateCell(1).SetCellValue("preejo@gmail.com"); row.CreateCell(2).SetCellValue("01/Jan/2014"); row.CreateCell(3).SetCellValue("27/Jan/2014"); row.CreateCell(4).SetCellValue("true"); //row.CreateCell(5).SetCellValue(((121234567.89).ToString("N", new CultureInfo("hi-IN"))));
//row.CreateCell(5).SetCellValue(Convert.ToDouble(123456.78));
row.CreateCell(5).SetCellValue(123456.78);
//row.GetCell(5).CellStyle = cellStyle;
row.GetCell(5).CellStyle = detailCurrencySubtotalCellStyle;




rowIndex++;
row = sheet.CreateRow(rowIndex);
row.CreateCell(0).SetCellValue("joby");
row.CreateCell(1).SetCellValue("joby@gmail.com"); row.CreateCell(2).SetCellValue("01/Jan/2013"); row.CreateCell(3).SetCellValue("27/Jan/2013"); row.CreateCell(4).SetCellValue("false"); row.CreateCell(5).SetCellValue(Convert.ToDouble(2323313.43)); //row.GetCell(5).CellStyle = cellStyle;
row.GetCell(5).CellStyle = detailCurrencySubtotalCellStyle;

//}



// Auto-size each column
for (int i = 0; i < sheet.GetRow(0).LastCellNum; i++)
sheet.AutoSizeColumn(i);


// Add row indicating date/time report was generated...
sheet.CreateRow(rowIndex + 1).CreateCell(0).SetCellValue("Report generated on " + DateTime.Now.ToString());

//formula
rowIndex++;
row = sheet.CreateRow(rowIndex);
Cell cell = row.CreateCell(5);

cell.SetCellType(CellType.FORMULA);
cell.CellFormula = string.Format("SUM(F{0}:F{1})", 2, 3);


cell.CellStyle = detailCurrencySubtotalCellStyle;



// Save the Excel spreadsheet to a MemoryStream and return it to the client
using (MemoryStream exportData = new MemoryStream())
{
workbook.Write(exportData);

string saveAsFileName = string.Format("MembershipExport-{0Big Grin | :-D }.xls", DateTime.Now).Replace("/", "-");

Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}", saveAsFileName));
Response.Clear();
Response.BinaryWrite(exportData.GetBuffer());
Response.End();
}
}

New Post: Protect Sheet with Auto filter enabled

$
0
0
I am creating excel ie xlsx file. The sheet is password protected so that user can not edit few columns, but once password protected user is not able to filter data in sheet.
can i have sheet with password protected with auto filter option enabled.

thanks in advance.

New Post: Print Object

$
0
0
i used C# and XSSFClientAnchor to create NPOI with image and i already change code to this ...

XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 800, 0, 4, rows, 5, rows + 1);

but is not work for me

have u other solution to resolved this problem

thank.

New Post: how i can disable protected view in a excel file with NPOI 1.2.5 when i created new file .xls

$
0
0
Nobody can help me?, any idea or clues?

New Post: ScatterChart markers

$
0
0
Hi.

Is there a way to hide the markers in a series of the scatter chart (make a smooth line)?

Thank you.

New Post: display a number with thousand separator in Indian style( 12, 12,34,567.89)in the exported excel sheet using program

$
0
0
Please upgrade to the latest version 2.0. Let me know if you can still reproduce the issue.

New Post: AutoSizeColumn got slow in NPOI 2.0

$
0
0
AutoSizeColumn needs to calculate text-based pixels. It must not be that fast. Be cautious when use it. But this is by design.
Viewing all 637 articles
Browse latest View live


Latest Images

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