Quantcast
Channel: EPPlus Issue Tracker Rss Feed
Viewing all 2262 articles
Browse latest View live

Commented Unassigned: Problem with Persian Fonts [15509]

$
0
0
I found out that ٍEPPlus has problem with Persian fonts like "B Nazanin". when I open an existed excel file and change some cell values, then saving using SaveAs method it becomes fail in saving persian fonts correctly.
when you open saved file in MS Excel you can see that the font is not correct. you can see correct font when you change the cell's font to another font and then change it again to "B Nazanin".
by checking Styles.xl file in back of excel file we can see that 'charset' tag of persian fonts are removed.
that caused font does'nt affect on strings and just showing its name in font name.
by adding this removed tag to styles it becomes fine.


Comments: Please answer and fix this problem. you must insert a tag in style file that specified charset.

Commented Unassigned: Use user defined functions in cell (calculation) [15516]

$
0
0
EPPlus offers a lot of functionality but I somehow miss one. Is it by design or am I just missing something? I would like EPPlus to calculate user defined functions, as often found in a vba code module. As a result of the calculation function, the #NAME? is the value of the cell and the FormulaParserManager Logging shows:

Timestamp: 16.08.2016 10:29:24

Worksheet: inputs and calculations
Address: O10
'MyFunctionInVBAModule' is not a supported function

Please let me know what I have to change/expect.

thx. Peter
Comments: Hi Peter, EPPlus can parse and calculate formulas containing the most common Excel functions, but it cannot evaluate userdefined VBA functions. What you can do is to implement your user defined functions in a .net lanugage such as c# and register them - using the same name as your VBA function - via _Workbook.FormulaParserManager_. Your custom functions should inherit the EPPlus class _ExcelFunction_. You can see in the sample project (see the Downloads section above) how to do this. /Mats

Created Unassigned: EPPlus Returns "STG_E_WRITEFAULT" When It Attempts to Read a Valid .xlsx File [15520]

$
0
0
The EPPlus Call to Method "new ExcelPackage(rawStream)" Returns "STG_E_WRITEFAULT" When It Attempts to Read a Valid .xlsx File

This problem occurs when the EPPlus "ExcelPackage" constructor is called with a valid .xlsx file stream.
EPPlus returns a misleading "STG_E_WRITEFAULT" exception.
The actual problem is occurring because of an error in the DotNetZip library that EPPlus is using to read the .xlsx file stream.
This error is occurring on the EPPlus release dated July 19,2016 but it occurs on earlier versions as well.


Here is a complete description of the steps leading up to the error.

1. Our software calls the EPPlus "ExcelPackage" constructor passing a valid .xlsx file stream.
2. EPPlus calls the DotNetZip library's "Zip.ZipInputStream.GetNextEntry" method to extract each of the "ZipEntry" from the .xlsx stream.
3. There is a bug in the DotNetZip library's "ZipEntry.ReadHeader" method in source file "ZipEntry.Read.cs" at line 238. That line contains the following statement:
"ze._LengthOfTrailer += 16;" Instead, that statement should simply set the "_LengthOfTrailer" property value rather than incrementing it.
4. This error occurs fairly rarely because the code that increments "_LengthOfTrailer" is normally invoked only once. However, it can be invoked more than once if the call to method "Zip.SharedUtilities.FindSignature" at line 196 detects a spurious "ZipEntryDataDescriptorSignature" in the compressed data. In that case, the statement at line 242 sets the variable "wantMore" to "true" and it looks for the actual "ZipEntryDataDescriptorSignature" following the compressed data. When the actual "ZipEntryDataDescriptorSignature" is found, the value of property "ze._LengthOfTrailer" will have been erroneously incremented to "32" or some other multiple of "16".
5. Method "ZipEntry.ReadHeader" at line 298 sets property "ze._TotalEntrySize" to the wrong value because property "ze._LengthOfTrailer" contains the wrong value.
6. Method "ReadEntry" at line 375 does a Seek to the wrong stream position because property "entry._LengthOfTrailer" contains the wrong value. Instead of pointing to the next ZipHeader, the stream is now positioned 16 bytes beyond the next ZipHeader.
7. Method "GetNextEntry" at line 649 sets property "_endOfEntry" to the wrong value because "_inputStream.Position" contains the wrong value.
8. The next call to "GetNextEntry" calls method "ReadEntry" in source file "ZipInputStream.cs" at line 645.
9. Method "ReadEntry" calls method "ReadHeader" in source file "ZipEntry.Read.cs" at line 368.
10. Method "ReadHeader" throws a BadReadException at line 92 with the error message "Bad signature (0xnnnnnnnn) at position 0xnnn" because the signature value does not match "ZipConstants.ZipEntrySignature". This is occurring because the stream is positioned 16 bytes beyond the actual signature.
11. The EPPlus method "Load" in source file "excelpackage.cs" at line 1165 catches the "BadReadException".
12. The exception handler calls method "Utils.CompoundDocument.GetLockbyte" which calls method "Utils.CompoundDocument.ILockBytes.WriteAt". This results in EPPlus generating the exception "A disk error occurred during a write operation. (Exception from HRESULT: 0x8003001D (STG_E_WRITEFAULT))". This exception obscures the original exception making it more difficult to recognize the actual problem.


Fixing the Problem

1. The direct cause of this problem is the erroneous statement in source file "ZipEntry.Read.cs" at line 238. The line should read "ze._LengthOfTrailer = 16;" rather than "ze._LengthOfTrailer += 16;". Line 220 has a similar problem when property "_InputUsesZip64" is true. Both lines should be changed to do an assignment rather than an increment.
2. I am not sure if the exception handling code in source file "excelpackage.cs" at line 1165 is working correctly. It seems to be attempting to handle the case when the .xlsx stream is encrypted, but it throws a misleading exception when it tries to read an unencrypted file.
3. I am not sure that EPPlus is reading the ZipEntries in the best way. I believe that it is recommended to read the ZipEntries from the "Central Directory" located at the end of the Zip file rather than reading the "Local File Headers" scattered throughout the Zip file. Reading from the "Central Directory" is said to be both more reliable and faster because much less data is being read. The "Central Directory" entries can be read by calling the DotNetZip "ZipFile.Read" method and iterating through the "ZipEntry" values from the "ZipFile". Forgive me if you are not using this approach because there are problems with doing so.


I have attached an .xlsx file that exhibits the problem described above. This .xlsx file contains the following ZipEntries:

"xl/comments1.xml"
"xl/drawings/vmlDrawing1.vml"
"xl/drawings/drawing1.xml"
"xl/drawings/drawing2.xml"
"xl/drawings/drawing3.xml"
"xl/drawings/drawing4.xml"
"xl/drawings/drawing5.xml"
"xl/worksheets/sheet1.xml"
"xl/worksheets/_rels/sheet1.xml.rels"
"xl/worksheets/sheet2.xml"
"xl/worksheets/_rels/sheet2.xml.rels"
"xl/worksheets/sheet3.xml"
"xl/worksheets/_rels/sheet3.xml.rels"
"xl/worksheets/sheet4.xml"
"xl/worksheets/_rels/sheet4.xml.rels"
"xl/worksheets/sheet5.xml"
"xl/worksheets/_rels/sheet5.xml.rels"
"xl/sharedStrings.xml" <<<< The entry provoking the DotNetZip library bug.
"styles.xml" <<<< The entry throwing the exception because the stream position is wrong.
"workbook.xml"
"workbook.xml.rels"
".rels"
"[content_Types].xmles"

The problem is occurring when reading the ZipEntry for "xl/sharedStrings.xml". The error results in the starting stream position of ZipEntry "styles.xml" being 937410 rather than the correct stream position of 937394. Note that the "Central Directory" entry for "styles.xml" contains the correct "_RelativeOffsetOfLocalHeader" property value of 937394.


Commented Unassigned: Problem with Persian Fonts [15509]

$
0
0
I found out that ٍEPPlus has problem with Persian fonts like "B Nazanin". when I open an existed excel file and change some cell values, then saving using SaveAs method it becomes fail in saving persian fonts correctly.
when you open saved file in MS Excel you can see that the font is not correct. you can see correct font when you change the cell's font to another font and then change it again to "B Nazanin".
by checking Styles.xl file in back of excel file we can see that 'charset' tag of persian fonts are removed.
that caused font does'nt affect on strings and just showing its name in font name.
by adding this removed tag to styles it becomes fine.


Comments: I have found the source of the problem. if you open the xlsx file generated with the Aspose.Cells With WinRar and open styles.xml there is an XML node for the "B Traffic" font like this. <font> <sz val="18" /> <color theme="1" /> <name val="B Nazanin" /> <family val="2" /> </font> if you compare this XML node with the one in correct xlsx file generated with MS Excel you can see the difference. <font> <sz val="18"/> <color theme="1"/> <name val="B Nazanin"/> <charset val="178"/> </font> now if you correct this node and put it back in xlsx file generated with EPPlus the font will be shown correctly in MS Excel.

Created Unassigned: Worksheets containing ConditionalFormatting created in Excel aren't opening [15521]

$
0
0
I have an Excel file that I am using as a template to copy over to a new workbook. The excel file is created in Excel 2013. Everything will work fine until I add conditional formatting from excel. Once the conditional formatting is added epplus will not load the worksheet.

Sample Code:

```
Dim wb as Workbook = New ExcelPackage(New FileInfo("C:\template.xlsx)).Workbook
Messagebox.Show("wb.worksheets.count") 'Messagebox Displays '0'
```

if you open template.xlsx and remove the conditional formatting. It will open fine.

Created Unassigned: How to store excel data into DB using php [15522]

$
0
0
Hello.

Any one has been idea how to store excel multiple data store into Database.

Created Unassigned: Datavalidations can't be read after opening file in excel and the saving it. [15523]

$
0
0
Hi.

When you create an excel sheet with the EPPlus library it's possible to add DataValidation lists to it and this works fine. When you then save the excel file to disk and afterwords read it again with the EPPlus library you can still find the DataValidation lists that were created, so this to works fine too.
But if you open the excel file in Microsoft excel and then save it and now open it with EPPlus library, the DataValidation list can't be found anymore. I've looked at the xml files that reside in a xlsx file and I saw that the DataValidation lists still exist, but the are located in a different xml header then when they were created with EPPlus.
This is probably the reason they aren't found anymore by EPPlus, but can somebody tell me how I can still get this to work?
A workaround will be fine too, the only thing I want to know is what DataValidationList is added to what cell.

Reproduction steps.
1. Create an excel sheet with a DataValidationList based on a formula.
2. Open the created excel sheet in Microsoft excel.
3. Save the file within Microsoft excel.
4. Open the file with the EPPlus library
5. Notice that the DataValidation lists aren't there anymore.

I hope someone can help me.

Kind Regards,

Edited Unassigned: Datavalidations can't be read after opening file in excel and then saving it. [15523]

$
0
0
Hi.

When you create an excel sheet with the EPPlus library it's possible to add DataValidation lists to it and this works fine. When you then save the excel file to disk and afterwords read it again with the EPPlus library you can still find the DataValidation lists that were created, so this to works fine too.
But if you open the excel file in Microsoft excel and then save it and now open it with EPPlus library, the DataValidation list can't be found anymore. I've looked at the xml files that reside in a xlsx file and I saw that the DataValidation lists still exist, but the are located in a different xml header then when they were created with EPPlus.
This is probably the reason they aren't found anymore by EPPlus, but can somebody tell me how I can still get this to work?
A workaround will be fine too, the only thing I want to know is what DataValidationList is added to what cell.

Reproduction steps.
1. Create an excel sheet with a DataValidationList based on a formula.
2. Open the created excel sheet in Microsoft excel.
3. Save the file within Microsoft excel.
4. Open the file with the EPPlus library
5. Notice that the DataValidation lists aren't there anymore.

I hope someone can help me.

Kind Regards,


Created Unassigned: Problem with ABS in formulas [15524]

$
0
0
In Excel, when the ABS function is called on a blank cell, it returns a 0. But when the EPPlus Formula Parser tries to execute ABS on a blank cell, it returns an error message.

Created Unassigned: Removed Part: /xl/vbaProject.bin part. (Visual Basic for Applications (VBA)) [15525]

$
0
0
Hi, I am using version 4.1.0.

I try to overwrite some VBA module's code, but it seems that even if I only read a VBAProject Property (eg Description) and save it, the VBA Project is lost, and I get the following error when I open the document:

Removed Part: /xl/vbaProject.bin part. (Visual Basic for Applications (VBA))

My Code:

FileInformation fileInformation = Microsoft.SharePoint.Client.File.OpenBinaryDirect(clientContext, item.FolderName + "/" + item.FileName);

MemoryStream ms = new MemoryStream();

fileInformation.Stream.CopyTo(ms);

using (var p = new ExcelPackage(ms))
{
var description = p.Workbook.VbaProject.Description;
//Here I should do some work with VBA
p.SaveAs(new FileInfo("foo.xlsm"));
}


Thanks in advance.

Commented Unassigned: Removed Part: /xl/vbaProject.bin part. (Visual Basic for Applications (VBA)) [15525]

$
0
0
Hi, I am using version 4.1.0.

I try to overwrite some VBA module's code, but it seems that even if I only read a VBAProject Property (eg Description) and save it, the VBA Project is lost, and I get the following error when I open the document:

Removed Part: /xl/vbaProject.bin part. (Visual Basic for Applications (VBA))

My Code:

FileInformation fileInformation = Microsoft.SharePoint.Client.File.OpenBinaryDirect(clientContext, item.FolderName + "/" + item.FileName);

MemoryStream ms = new MemoryStream();

fileInformation.Stream.CopyTo(ms);

using (var p = new ExcelPackage(ms))
{
var description = p.Workbook.VbaProject.Description;
//Here I should do some work with VBA
p.SaveAs(new FileInfo("foo.xlsm"));
}


Thanks in advance.
Comments: I realized this happens when the VBA Project is protected with password. Is there a way we can specify the password programmatically? I tried with: p.Workbook.VbaProject.Protection.SetPassword(""); p.Workbook.VbaProject.Protection.SetPassword(null); p.Workbook.VbaProject.Protection.SetPassword(<original password>); But it did not work.

Edited Unassigned: Problem with ABS in formulas [15524]

$
0
0
In Excel, when the ABS function is called on a blank cell, it returns a 0. But when the EPPlus Formula Parser tries to execute ABS on a blank cell, it returns an error message.

Commented Unassigned: Problem with ABS in formulas [15524]

$
0
0
In Excel, when the ABS function is called on a blank cell, it returns a 0. But when the EPPlus Formula Parser tries to execute ABS on a blank cell, it returns an error message.
Comments: Fixed in changeset b8f3cbcaec00

Created Unassigned: Excel opens file created by EPPlus with error [15526]

$
0
0
I created excel file by EPPlus with 2 sheets: data and chart on the data. Excel can open the file without any errors.
Now, I read (by EPPlus) and save the file again without any changes and Excel opens the file with error message and doesn't show chart.

I published the issue on stackoverflow: http://stackoverflow.com/questions/39012559/excel-opens-file-created-by-epplus-with-error

The stackoverflow's post has a answer, but it doesn't solve the issue.

thank you,
Igor.

Commented Unassigned: Removing Comments Issue [15432]

$
0
0
Hello,

We're using version 4.0.5 of EP Plus, which is generally working very well, so thanks for developing this excellent library. We've encountered one issue recently that we're unable to work around when removing comments. These can successfully remove comments using the following code -

workSheet.Comments.Remove(workSheet.Cells[row, col].Comment);

and then after saving the spreadsheet opens successfully in excel and the comments are gone.

However, the next time we open this and then loop through the cells we get an XmlException thrown when checking the comments on this line -

if (workSheet.Cells[row, col].Comment != null)

Currently then we have to set the comment to be an empty string, but excel views this as a comment and so the red comment marker is still appended to the cell in question.

The exception thrown is -

System.Xml.XmlException: Data at the root level is invalid. Line 41, position 7.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at OfficeOpenXml.XmlHelper.LoadXmlSafe(XmlDocument xmlDoc, Stream stream)
at OfficeOpenXml.Drawing.Vml.ExcelVmlDrawingBaseCollection..ctor(ExcelPackage pck, ExcelWorksheet ws, Uri uri)
at OfficeOpenXml.Drawing.Vml.ExcelVmlDrawingCommentCollection..ctor(ExcelPackage pck, ExcelWorksheet ws, Uri uri)
at OfficeOpenXml.ExcelWorksheet.CreateVmlCollection()
at OfficeOpenXml.ExcelWorksheet.get_Comments()
at OfficeOpenXml.ExcelRangeBase.get_Comment()
at ExcelServices.Helpers.ExcelFileHelper.RemoveCommentsAndCellFormatting(ExcelWorksheet workSheet) in c:\TFS\Projects\CRM\Ada\ExcelServices\Helpers\ExcelFileHelper.cs:line 39
at ExcelServices.ImportFileProcessor.ValidateWorkSheet(ExcelWorksheet workSheet) in c:\TFS\Projects\CRM\Ada\ExcelServices\ImportFileProcessor.cs:line 200
at ExcelServices.ImportFileProcessor.ProcessFile(String fileName, Boolean update, Action importAction) in c:\TFS\Projects\CRM\Ada\ExcelServices\ImportFileProcessor.cs:line 155


Any help in resolving this would be much appreciated.
Comments: Same Issue here. The File is saved by EPPlus and can't be processed again (Exception on accessing Comments) Worksheet.Comments throws Exception caused by corrupted vmlDrawing1.vml ``` </xml>etmode="auto"> <v:fill color2="#ffffe1"/> <v:shadow on="t" color="black" obscured="t"/> <v:path o:connecttype="none"/> <v:textbox style='mso-direction-alt:auto;mso-fit-shape-to-text:t'> <div style='text-align:left'/> </v:textbox> <x:ClientData ObjectType="Note"> <x:MoveWithCells/> <x:SizeWithCells/> <x:Anchor> 7, 15, 486, 2, 10, 59, 488, 11</x:Anchor> <x:AutoFill>False</x:AutoFill> <x:Row>486</x:Row> <x:Column>6</x:Column> </x:ClientData> </v:shape> ``` Excel can still open the file, after resave in Excel, it is working again in EPPPLus

Commented Unassigned: Removing Comments Issue [15432]

$
0
0
Hello,

We're using version 4.0.5 of EP Plus, which is generally working very well, so thanks for developing this excellent library. We've encountered one issue recently that we're unable to work around when removing comments. These can successfully remove comments using the following code -

workSheet.Comments.Remove(workSheet.Cells[row, col].Comment);

and then after saving the spreadsheet opens successfully in excel and the comments are gone.

However, the next time we open this and then loop through the cells we get an XmlException thrown when checking the comments on this line -

if (workSheet.Cells[row, col].Comment != null)

Currently then we have to set the comment to be an empty string, but excel views this as a comment and so the red comment marker is still appended to the cell in question.

The exception thrown is -

System.Xml.XmlException: Data at the root level is invalid. Line 41, position 7.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at OfficeOpenXml.XmlHelper.LoadXmlSafe(XmlDocument xmlDoc, Stream stream)
at OfficeOpenXml.Drawing.Vml.ExcelVmlDrawingBaseCollection..ctor(ExcelPackage pck, ExcelWorksheet ws, Uri uri)
at OfficeOpenXml.Drawing.Vml.ExcelVmlDrawingCommentCollection..ctor(ExcelPackage pck, ExcelWorksheet ws, Uri uri)
at OfficeOpenXml.ExcelWorksheet.CreateVmlCollection()
at OfficeOpenXml.ExcelWorksheet.get_Comments()
at OfficeOpenXml.ExcelRangeBase.get_Comment()
at ExcelServices.Helpers.ExcelFileHelper.RemoveCommentsAndCellFormatting(ExcelWorksheet workSheet) in c:\TFS\Projects\CRM\Ada\ExcelServices\Helpers\ExcelFileHelper.cs:line 39
at ExcelServices.ImportFileProcessor.ValidateWorkSheet(ExcelWorksheet workSheet) in c:\TFS\Projects\CRM\Ada\ExcelServices\ImportFileProcessor.cs:line 200
at ExcelServices.ImportFileProcessor.ProcessFile(String fileName, Boolean update, Action importAction) in c:\TFS\Projects\CRM\Ada\ExcelServices\ImportFileProcessor.cs:line 155


Any help in resolving this would be much appreciated.
Comments: Can you recreate the issue programmatically? i.e. for unit tests? I could never repro this behaviour in a unit test

Commented Unassigned: Removing Comments Issue [15432]

$
0
0
Hello,

We're using version 4.0.5 of EP Plus, which is generally working very well, so thanks for developing this excellent library. We've encountered one issue recently that we're unable to work around when removing comments. These can successfully remove comments using the following code -

workSheet.Comments.Remove(workSheet.Cells[row, col].Comment);

and then after saving the spreadsheet opens successfully in excel and the comments are gone.

However, the next time we open this and then loop through the cells we get an XmlException thrown when checking the comments on this line -

if (workSheet.Cells[row, col].Comment != null)

Currently then we have to set the comment to be an empty string, but excel views this as a comment and so the red comment marker is still appended to the cell in question.

The exception thrown is -

System.Xml.XmlException: Data at the root level is invalid. Line 41, position 7.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at OfficeOpenXml.XmlHelper.LoadXmlSafe(XmlDocument xmlDoc, Stream stream)
at OfficeOpenXml.Drawing.Vml.ExcelVmlDrawingBaseCollection..ctor(ExcelPackage pck, ExcelWorksheet ws, Uri uri)
at OfficeOpenXml.Drawing.Vml.ExcelVmlDrawingCommentCollection..ctor(ExcelPackage pck, ExcelWorksheet ws, Uri uri)
at OfficeOpenXml.ExcelWorksheet.CreateVmlCollection()
at OfficeOpenXml.ExcelWorksheet.get_Comments()
at OfficeOpenXml.ExcelRangeBase.get_Comment()
at ExcelServices.Helpers.ExcelFileHelper.RemoveCommentsAndCellFormatting(ExcelWorksheet workSheet) in c:\TFS\Projects\CRM\Ada\ExcelServices\Helpers\ExcelFileHelper.cs:line 39
at ExcelServices.ImportFileProcessor.ValidateWorkSheet(ExcelWorksheet workSheet) in c:\TFS\Projects\CRM\Ada\ExcelServices\ImportFileProcessor.cs:line 200
at ExcelServices.ImportFileProcessor.ProcessFile(String fileName, Boolean update, Action importAction) in c:\TFS\Projects\CRM\Ada\ExcelServices\ImportFileProcessor.cs:line 155


Any help in resolving this would be much appreciated.
Comments: I tried to isolate the issue without success, but got another issue during my tests: ``` [TestMethod] public void TestComments() { using (ExcelPackage pck = new ExcelPackage(new FileInfo(@"c:\temp\test.xlsx"))) { SetComments(pck); TestComments(pck); SaveWorksheet(pck); } ReadWorksheet(); } private void SaveWorksheet(ExcelPackage pck) { var fi = new FileInfo(@"c:\temp\result.xlsx"); if (fi.Exists) { fi.Delete(); } pck.SaveAs(fi); } private void TestComments(ExcelPackage pck) { var ws = pck.Workbook.Worksheets[1]; Console.WriteLine(@"comments:" + ws.Comments.Count); var x = ws.Comments.Cast<ExcelComment>().ToList(); } private void SetComments(ExcelPackage pck) { var ws = pck.Workbook.Worksheets[1]; var cell = ws.Cells[2, 1, 3, 1]; var text = "sometext"; cell.Value = text; if (cell.Comment == null) cell.AddComment(text, "System"); } private void ReadWorksheet() { using (ExcelPackage pck = new ExcelPackage(new FileInfo(@"c:\temp\result.xlsx"))) { TestComments(pck); } } ``` The generated result.xlsx can be read by EPPlus but not by Excel 2016 Excel shows an alert: "We found a problem with some content in 'result.xlsx'. The issue is generated by applying a comment to an excel range with several cells: ``` var cell = ws.Cells[2, 1, 3, 1]; // not working vs var cell = ws.Cells[2, 1]; // working ``` Es mentioned above this is not my real live issue...

Created Unassigned: Apostrophe in tab name and printer settings error [15527]

$
0
0
Hi,

I'am able to generate an excel file without any issues, expect when i'm using an "apostrophe" in the tab name and using the PrinterSettings.RepeatRows method.

eg:
this is fine:
ws = pck.Workbook.Worksheets.Add("todays meetings");
ws.PrinterSettings.RepeatRows = new ExcelAddress("$1:$2");


this will crash
ws = pck.Workbook.Worksheets.Add("today's meetings");
ws.PrinterSettings.RepeatRows = new ExcelAddress("$1:$2");

Thanks !

Created Unassigned: ExcelDataValidationType.None not implemented [15528]

$
0
0
DataValidations fails with the following error:
"Invalid schemaname: none"

This Fails:
var DataValidation = ws.DataValidations;

Because ExcelDataValidationType.None is not yet implemented, but should be:
```
Custom Data validation which use a custom formula to check the cell value.
Date Data validation which checks for date values satisfying the given condition.
Decimal Data validation which checks for decimal values satisfying the given condition.
List Data validation which checks for a value matching one of list of values.
None Allows any type of value and does not check for a type or range of value.
TextLength Data validation which checks for text values, whose length satisfies the given condition.
Time Data validation which checks for time values satisfying the given condition.
Whole Data validation which checks for whole number values satisfying the given condition.
```


Created Unassigned: Make ExcelDataValidation.Formula1 Public [15529]

$
0
0
In order to get the values from a drop-down menu I need to read the currently protected ExcelDataValidation.Formula1 parameter that contains the refference to the NamedRange.

So can you plase make ExcelDataValidation.Formula1 Public?

I got around this by reading the value from the WorksheetXml, but it's not pretty:

```
var cell = ws.Cells[1, 1];
var DataValidation = ws.DataValidations[cell.Address];
if (DataValidation != null)
{
field.Tooltip = DataValidation.Prompt;
//field.Formula1 = DataValidation.Formula1; //Protected parameter, read from WorksheetXml below

var nsmgr = new XmlNamespaceManager(ws.WorksheetXml.NameTable);
nsmgr.AddNamespace("ns", ws.WorksheetXml.SelectSingleNode("*").NamespaceURI);
var dataValidation = ws.WorksheetXml.SelectSingleNode("//ns:dataValidation[@sqref='" + DataValidation.Address.Address + "']", nsmgr);
string rangeName = null;
if (dataValidation != null) {
var formula1 = dataValidation.SelectSingleNode("ns:formula1", nsmgr);
if (formula1 != null)
rangeName = formula1.InnerText;
}
```
Viewing all 2262 articles
Browse latest View live


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