Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all 1877 articles
Browse latest View live

Edited Unassigned: borderstyle problem [9321]

$
0
0
Hello,

I have an issue, i'm working with MS Dynamics AX 2009.
I need to apply a border style, but the values for the XLBorderStyleValues enum aren't showing up.
I believe it should be like this:
```
style = cellrange.get_Style();
border = style.get_Border();
border.set_OutsideBorderColor(ClosedXML.Excel.XLColor::get_Black());
border.set_OutsideBorder(ClosedXML.Excel.XLBorderStyleValues.Thin);
```
but it won't let me compile and gives a syntax error.
I noticed that some methods weren't available in MS Dynamics AX compared to c# environment.

Thanks.

Commented Unassigned: borderstyle problem [9321]

$
0
0
Hello,

I have an issue, i'm working with MS Dynamics AX 2009.
I need to apply a border style, but the values for the XLBorderStyleValues enum aren't showing up.
I believe it should be like this:
```
style = cellrange.get_Style();
border = style.get_Border();
border.set_OutsideBorderColor(ClosedXML.Excel.XLColor::get_Black());
border.set_OutsideBorder(ClosedXML.Excel.XLBorderStyleValues.Thin);
```
but it won't let me compile and gives a syntax error.
I noticed that some methods weren't available in MS Dynamics AX compared to c# environment.

Thanks.
Comments: Looks like an environment thing specific to MS Dynamics. XLBorderStyleValues is a public enum.

Commented Unassigned: Rels file contains invalid (sort of) reference. [9320]

$
0
0
When saving a workbook, the rels file in the package refers to the workbook as "/xl/workbook.xml".

When opening in Excel it doesn't care, but if you save the file using excel (after opening it) the leading forward-slash is now gone.

A quick search of the web (and your source code) shows that this is done by the SDK and not ClosedXML.

As I said, this doesn't cause an issue for Excel, but other components that read Excel files can have trouble dealing with the leading forward-slash (e.g. FlexCel).

Is there anyway you could add compensation for this? - perhaps detect a leading forward-slash and remove it before handing an ID off to the rel id generator?
Comments: I would only add it if it's minimally invasive (after all, Excel and Open XML SDK are happy about it). Submit a pull request with the changes and I'll take a look at it.

Source code checked in, #10839d45a9ce688094a2b9264a6650bf9334de53

New Post: Value was either too large or too small for an Int32

New Comment on "Showcase"

$
0
0
Any examples of this tool that include the USING statements that are necessary to successfully run the examples??

New Post: Value was either too large or too small for an Int32

$
0
0
C:\EEP2012\ClosedXML\Excel\XLWorkbook_Load.cs
LINE 1578:
        if (pageSetup.FirstPageNumber != null)
            ws.PageSetup.FirstPageNumber = Int32.Parse(pageSetup.FirstPageNumber.InnerText);
//ws.PageSetup.FirstPageNumber is {4294963191}

Commented Unassigned: borderstyle problem [9321]

$
0
0
Hello,

I have an issue, i'm working with MS Dynamics AX 2009.
I need to apply a border style, but the values for the XLBorderStyleValues enum aren't showing up.
I believe it should be like this:
```
style = cellrange.get_Style();
border = style.get_Border();
border.set_OutsideBorderColor(ClosedXML.Excel.XLColor::get_Black());
border.set_OutsideBorder(ClosedXML.Excel.XLBorderStyleValues.Thin);
```
but it won't let me compile and gives a syntax error.
I noticed that some methods weren't available in MS Dynamics AX compared to c# environment.

Thanks.
Comments: I found the solution. One of the limitation in IntelliSense in MS Dynamics is that it does not support auto displaying the .NET enumeration value. Luckily there is a useful method called ClrInterop::parseClrEnum(_clrEnumTypeName, _enumValues), which you can convert a string of the .NET enum value to a CLRInterop object. So my code is like this: ``` style = cellrange.get_Style(); border = style.get_Border(); borderstyle = ClrInterop::parseClrEnum('ClosedXML.Excel.XLBorderStyleValues', 'Thin'); border.set_OutsideBorderColor(ClosedXML.Excel.XLColor::get_Black()); ```

New Post: How to determine if two cells are merged together

$
0
0
Thanks, that did that trick. Nice job by the way, really enjoying it.

Cheers,
Omni

New Post: ClosedXML and Compact Framework

$
0
0
Hi MDeLeon,

Thank you for your response.

I have tried a couple of example based on OpenXML buti'm still getting error ("The version of the assembly System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089 cannot be loaded by this version of the Microsoft .NET Compact Framework.").
I guess that's the reason that cause problem on ClosedXML..

New Post: Value was either too large or too small for an Int32

$
0
0
You don't have the latest source code.

Created Unassigned: richText.Bold returns false if entire cell text is bold... [9322]

$
0
0
Individual words are detected but if the entire string is bold, false is returned. Am I missing something?

Commented Unassigned: richText.Bold returns false if entire cell text is bold... [9322]

$
0
0
Individual words are detected but if the entire string is bold, false is returned. Am I missing something?
Comments: edit: item.Cell(y).HasRichText returns false if the entire string is bold

Commented Unassigned: richText.Bold returns false if entire cell text is bold... [9322]

$
0
0
Individual words are detected but if the entire string is bold, false is returned. Am I missing something?
Comments: I don't understand the problem: var ws = new XLWorkbook().AddWorksheet("Sheet1"); ws.Cell("A1").RichText.AddText("Bold").SetBold(); Console.WriteLine(ws.Cell("A1").HasRichText); // True because the cell has rich text ws.Cell("A2").Style.Font.SetBold(); Console.WriteLine(ws.Cell("A2").HasRichText); // False because the cell doesn't have rich text

Commented Unassigned: richText.Bold returns false if entire cell text is bold... [9322]

$
0
0
Individual words are detected but if the entire string is bold, false is returned. Am I missing something?
Comments: ``` //check for bolds if (y == 16 && item.Cell(y).HasRichText) { string storeHtml = rbm.toStr(item.Cell(y).Value); foreach (var richText in item.Cell(y).RichText) { if (richText.Bold) { storeHtml = storeHtml.Replace(richText.Text, "<b>" + richText.Text + "</b>"); } } array[y - 1] = storeHtml; } ``` Perhaps I shouldn't be using 'HasRichText.' How else would I know if there is bold text in the cell? Again, this works for bold items within the cell but not if the entire cell is bold text.

Commented Unassigned: richText.Bold returns false if entire cell text is bold... [9322]

$
0
0
Individual words are detected but if the entire string is bold, false is returned. Am I missing something?
Comments: ws.Cell("A1").Style.Font.SetBold(); Console.WriteLine(ws.Cell("A1").Style.Font.Bold); // True There are two ways to get the text in a cell to appear in bold: 1) Set the cell's font to bold 2) Insert a bolded rich text in the cell If you're trying to find if someone put anything in bold, be it the whole cell or a character within the text, then you have to check the cell's style AND the rich texts.

Commented Unassigned: Index of RowLabel and ColumnLabel in PivotTable [9326]

$
0
0
File XLWorkbook_Save.cs
Line 2222
Creation of RowLabels
```
var f = new Field {Index = pt.Fields.IndexOf(xlpf)};
```
Line 2240
```
var f = new Field {Index = pt.Fields.IndexOf(xlpf)};
```
The index of RowLabels and ColumnLabels is not correct because it is based on the order of Fields Collection

Is it correct changing the code in this way?
```
var f = new Field {Index = pt.RowLabels.IndexOf(pt.RowLabels.FirstOrDefault(p => p.SourceName == xlpf.SourceName))};
```
```
var f = new Field { Index = pt.ColumnLabels.IndexOf(pt.ColumnLabels.FirstOrDefault(p => p.SourceName == xlpf.SourceName)) };
```
Comments: How do I reproduce the problem? Here's the IndexOf method: public int IndexOf(IXLPivotField pf) { var selectedItem = _pivotFields.Select((item, index) => new {Item = item, Position = index}).FirstOrDefault(i => i.Item.Key == pf.SourceName); if (selectedItem == null) throw new IndexOutOfRangeException("Invalid field name."); return selectedItem.Position; }

Commented Issue: Open ClosedXML Doc on Android Device [8736]

$
0
0
Last year, I converted a program-generated Excel file from the old Microsoft document API to Open XML. It was clunky and time consuming, until I discovered ClosedXML. Wow! What a difference. It has been deployed for a year how, and is working great.

The documents are sent to users as attachments in emails. Recently, users have begun reading their email on their personal Android and iPad tablet PC's and phones. Most of the documents open with no issue, but one or two of the Excel files (created using Closed XML) give an error. The users quickly learned that if the opened the file on their Windows PC and then saved it and forwarded it to themselves via email, that then they could open the file on their mobile device. Obviously, they would like to not have to perform this extra step.

I have confirmed the scenario by copying a file and then opening it and saving it, then sending both to my Android phone. Sure enough, the latter works, but the original does not. I did a compare of both files using the Open XML 2.0 Productivity Tool, and the differences are very minor.

Has anyone encountered this problem, and is there any advice on how I can correct the problem? I am attaching both files for review and assessment.

Thanks.
Comments: Bad news. The problem is with the OpenXML SDK. The files it generates don't jive with some (not all) Android and iOS apps. You can test them by creating an empty spreadsheet with MS OpenXML SDK (2.0 or 2.5). It will not work on some Android apps. There's nothing I can do until Microsoft fixes their OpenXML SDK. Sorry.

New Post: Disable AutoFilter in Table

$
0
0
Is this the most current information?

I tried using

wb.Worksheet(worksheetNum).AutoFilter.Enabled = false ;
wb.Worksheet(worksheetNum).AutoFilter.clear();

The first one did nothing, the second has a error.

Please let me know how to disable the autofilter, thanks!

Source code checked in, #8e2b7fcbd991e92d58cb89a2022c3bc605fe8c31

$
0
0
Even more memory and performance improvements.
Viewing all 1877 articles
Browse latest View live


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