darknessomi / darknessomi/excellibrary

create Workbook from DataSet with Guid

Open
#116 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
C#
Stars
22
Forks
8
PR merge metrics
No merged PRs in 30d

Description

```
What steps will reproduce the problem?
1. Create a DataTable/DataSet have a Guid column
2. Use DataSetHelper to create WorkBook
3. throw exception "Invalid Cell Value"

My solution is convert value to string if value is Guid or any strange type
data.

Fix it:
1. Open WorkSheetEncoder.cs
2. Find "private static CellValue EncodeCell(Cell cell, SharedResource
sharedResource)" function
3. In the Else part, select and delete Else block, replace with this block

You can see in my attached cs file.
(Note: Sorry I don't know how to make a patch file)
================================================================================
======
else if (value is Guid)
{
LABELSST label = new LABELSST();
label.SSTIndex = sharedResource.GetSSTIndex(value.ToString());
return label;
}
else
{
try
{
LABELSST label = new LABELSST();
label.SSTIndex = sharedResource.GetSSTIndex(value.ToString());
return label;
}
catch
{
string type = value.GetType().FullName;
throw new Exception("Invalid cell value: type = " + type);
}
}
================================================================================
======
```

Original issue reported on code.google.com by `luckymon...@gmail.com` on 24 Nov 2011 at 7:04

Attachments:
- [WorkSheetEncoder.cs](https://storage.googleapis.com/google-code-attachments/excellibrary/issue-116/comment-0/WorkSheetEncoder.cs)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.