Fabian84 has uploaded a patch.
Description:
New Feature: Conditional Formats did not support StopIfTrue.
Implemented the reading and writing.
Based on Source Code ChangeSet: 79843
Fabian84 has uploaded a patch.
Description:
New Feature: Conditional Formats did not support StopIfTrue.
Implemented the reading and writing.
Based on Source Code ChangeSet: 79843
Fabian84 has uploaded a patch.
Description:
Code Issue: Difference between DotNet3.5 and DotNet4 version of ClosedXML library.
Change of DotNet3.5 to be the same as DotNet4.
Based on Source Code ChangeSet: 79843
Fabian84 has uploaded a patch.
Description:
Exception: During development of my other patches I had a lot of exceptions during saving of the document on this code line.
Based on Source Code ChangeSet: 79843
Using hello world and question on how to write to Memory Stream: https://closedxml.codeplex.com/discussions/248214
```
var workbook = new XLWorkbook();
var worksheet = workbook.Worksheets.Add("Sample Sheet");
worksheet.Cell("A1").Value = "Hello World!";
workbook.SaveAs("HelloWorld.xlsx");
var ms = new MemoryStream();
workbook.SaveAs(ms);
return ms;
```

```
at ClosedXML.Excel.XLWorkbook.CreateParts(SpreadsheetDocument document)
at ClosedXML.Excel.XLWorkbook.CreatePackage(Stream stream, Boolean newStream)
at ClosedXML.Excel.XLWorkbook.SaveAs(Stream stream)
```
I moved this to Discussion forum, You can close.
'Excel file definition
Dim wb As XLWorkbook = New XLWorkbook()
'Get data from dataset
Dim con = New SqlConnection(ConfigurationManager.ConnectionStrings("IPSdb").ConnectionString)
con.Open()
Dim cmd As New SqlCommand
Dim cmdstring As String = "SELECT Partnumber, Qty, Week, Year, Line, CBID FROM tblEDI"
cmd.CommandType = CommandType.Text
Dim objAdp = New SqlDataAdapter(cmdstring, con)
Dim ds = New DataSet()
objAdp.Fill(ds, "tblEDI")
Dim sheet1 = wb.Worksheets.Add("EDI raw data")
sheet1.Cell(1, 1).InsertTable(ds.Tables("tblEDI"), False, False)
Dim dataRange = sheet1.RangeUsed
'Add a new sheet for our pivot table
Dim sheet2 = wb.Worksheets.Add("PivotTable")
'Create the pivot table, using the data from the table
Dim pt = sheet2.PivotTables.AddNew("PivotTable", sheet2.Cell(1, 1), dataRange)
pt.RowLabels.Add("Partnumber")
pt.RowLabels.Add("Line")
pt.RowLabels.Add("CBID")
pt.ColumnLabels.Add("Year")
pt.ColumnLabels.Add("Week")
pt.Values.Add("Qty")
'Pivot format
With pt
.SortFieldsAtoZ = True
.ShowGrandTotalsColumns = False
.ShowGrandTotalsRows = False
.Theme = XLPivotTableTheme.PivotStyleLight1
.Subtotals = XLPivotSubtotals.DoNotShow
.Layout = XLPivotLayout.Tabular
.PreserveCellFormatting = True
.AutofitColumns = True
End With
'Adjust workbook and save
For Each ws As IXLWorksheet In wb.Worksheets
ws.ShowGridLines = False
ws.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left
ws.Columns.AdjustToContents()
Next
'Save Excel file to ExportedFiles
wb.SaveAs(path & "EDIexport " & Day(Today()) & "." & Month(Today()) & "." & Year(Today()) & ".xlsx")
fileexists = True
MySheet.Cell(1, 1).InsertTable(results)
My problem is in some cells that must be filled with only 5 white spaces, but when I check this cells, this cells are empty. public void ClosedXml(DataTable dt, string usertemplate, string exceltab)
{
var workbook = new XLWorkbook(usertemplate);
var worksheet = workbook.Worksheet(exceltab);
worksheet.Cell("A2").InsertData(dt.AsEnumerable());
workbook.Save();
}
But when I opened the Excel file, the results were not the ones I expected. Dim wb As New ClosedXML.Excel.XLWorkbook()
wb.Worksheets.Add(dt, dt.TableName.ToString)
Response.Clear()
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
Response.AddHeader("content-disposition", "attachment;filename=MasterCredReport.xlsx")
Using memoryStream As New MemoryStream()
wb.SaveAs(memoryStream)
memoryStream.WriteTo(Response.OutputStream)
memoryStream.Close()
End Using