OpenXML - Table Creation, How do I create tables without requiring excel to repair them












0















I'm creating multiple spreadsheets (separate files), each containing multiple sheets, and when I open the output file of one of these spreadsheets in excel it asks if I want to repair it (this only happens when I add tables), and shows what was repaired:



Repaired Records: Table from /xl/tables/table1.xml part (Table)


After repairing, the file is in the correct format, but as this is being automated I can't reply on using excel to repair these files. It only causes this problem when I create a table.



For example: I call the Define Table method using the following parameters to create a table of 11 Rows (Rows 2-12 inclusive) and 8 Columns (1-8 inclusive):



DefineTable(worksheetPart, 2, 12, 1, 8);


The DefineTable method is shown below:



private static void DefineTable(WorksheetPart worksheetPart, int rowMin, int rowMax, int colMin, int colMax)
{
TableDefinitionPart tableDefinitionPart = worksheetPart.AddNewPart<TableDefinitionPart>("rId" + (worksheetPart.TableDefinitionParts.Count() + 1));
int tableNo = worksheetPart.TableDefinitionParts.Count();

string reference = ((char)(64 + colMin)).ToString() + rowMin + ":" + ((char)(64 + colMax)).ToString() + rowMax;

Table table = new Table() { Id = (UInt32)tableNo, Name = "Table" + tableNo, DisplayName = "Table" + tableNo, Reference = reference, TotalsRowShown = false };
AutoFilter autoFilter = new AutoFilter() { Reference = reference };

TableColumns tableColumns = new TableColumns() { Count = (UInt32)(colMax - colMin + 1) };
for (int i = 0; i < (colMax - colMin + 1); i++)
{
tableColumns.Append(new TableColumn() { Id = (UInt32)(i + 1), Name = "Column" + i });
}

TableStyleInfo tableStyleInfo = new TableStyleInfo() { Name = "TableStyleLight1", ShowFirstColumn = false, ShowLastColumn = false, ShowRowStripes = true, ShowColumnStripes = false };

table.Append(autoFilter);
table.Append(tableColumns);
table.Append(tableStyleInfo);

tableDefinitionPart.Table = table;

TableParts tableParts = new TableParts() { Count = (UInt32)1 };
TablePart tablePart = new TablePart() { Id = "rId" + tableNo };

tableParts.Append(tablePart);

worksheetPart.Worksheet.Append(tableParts);
}


I'm not sure why the table is being constructed incorrectly, I would appreciate any help I can get to fix this.



I will also include table1.xml before and after being repaired:
table1.xml Before Repair:



<?xml version="1.0" encoding="utf-8" ?>
<x:table id="1" name="Table1" displayName="Table1" ref="A2:H12"
totalsRowShown="0"
xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<x:autoFilter ref="A2:H12"/>
<x:tableColumns count="8">
<x:tableColumn id="1" name="Column0"/>
<x:tableColumn id="2" name="Column1"/>
<x:tableColumn id="3" name="Column2"/>
<x:tableColumn id="4" name="Column3"/>
<x:tableColumn id="5" name="Column4"/>
<x:tableColumn id="6" name="Column5"/>
<x:tableColumn id="7" name="Column6"/>
<x:tableColumn id="8" name="Column7"/>
</x:tableColumns>
<x:tableStyleInfo name="TableStyleLight1" showFirstColumn="0"
showLastColumn="0" showRowStripes="1" showColumnStripes="0"/>
</x:table>


table1.xml After Repair:



<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision"
xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3"
mc:Ignorable="xr xr3" xr:uid="{00000000-000C-0000-FFFF-FFFF00000000}" id="1"
name="Table1" displayName="Table1" ref="A2:H12" totalsRowShown="0">
<autoFilter xr:uid="{00000000-0009-0000-0100-000001000000}" ref="A2:H12"/>
<tableColumns count="8">
<tableColumn xr3:uid="{00000000-0010-0000-0000-000001000000}" id="1"
name="Column0"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000002000000}" id="2"
name="Column1"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000003000000}" id="3"
name="Column2"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000004000000}" id="4"
name="Column3"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000005000000}" id="5"
name="Column4"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000006000000}" id="6"
name="Column5"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000007000000}" id="7"
name="Column6"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000008000000}" id="8"
name="Column7"/>
</tableColumns>
<tableStyleInfo name="TableStyleLight1" showFirstColumn="0"
showLastColumn="0" showRowStripes="1" showColumnStripes="0"/>
</table>


Thanks in advance.










share|improve this question























  • have you tried using your debugger to step through the code?

    – JohnB
    Nov 23 '18 at 3:55











  • Yes, I tried using my debugger, and didn't find the issue. I tried adding 3 tables to 2 different sheets in one spreadsheet, and I noticed that the repaired records were for tables 1 to 6. This makes me think I might need to change TableIds from 1-3 on sheet 1 and 1-3 on sheet 2, to 1-3 on sheet 1 and 4-6 on sheet 2.

    – Jacob Carrol
    Nov 23 '18 at 5:16











  • I recommend you use the Open XML SDK Productivity Tool to track down the problem in your code. Create a minimal workbook that has the problem. Open the workbook, let Excel repair it, then save as to a different name. Open the repaired workbook and look at the code the Tool proposes to create it. Compare that with your current code. It might also help to open the "bad" workbook in the Tool then use the "Compare" functionality to compare it to the "good" version.

    – Cindy Meister
    Nov 23 '18 at 11:33
















0















I'm creating multiple spreadsheets (separate files), each containing multiple sheets, and when I open the output file of one of these spreadsheets in excel it asks if I want to repair it (this only happens when I add tables), and shows what was repaired:



Repaired Records: Table from /xl/tables/table1.xml part (Table)


After repairing, the file is in the correct format, but as this is being automated I can't reply on using excel to repair these files. It only causes this problem when I create a table.



For example: I call the Define Table method using the following parameters to create a table of 11 Rows (Rows 2-12 inclusive) and 8 Columns (1-8 inclusive):



DefineTable(worksheetPart, 2, 12, 1, 8);


The DefineTable method is shown below:



private static void DefineTable(WorksheetPart worksheetPart, int rowMin, int rowMax, int colMin, int colMax)
{
TableDefinitionPart tableDefinitionPart = worksheetPart.AddNewPart<TableDefinitionPart>("rId" + (worksheetPart.TableDefinitionParts.Count() + 1));
int tableNo = worksheetPart.TableDefinitionParts.Count();

string reference = ((char)(64 + colMin)).ToString() + rowMin + ":" + ((char)(64 + colMax)).ToString() + rowMax;

Table table = new Table() { Id = (UInt32)tableNo, Name = "Table" + tableNo, DisplayName = "Table" + tableNo, Reference = reference, TotalsRowShown = false };
AutoFilter autoFilter = new AutoFilter() { Reference = reference };

TableColumns tableColumns = new TableColumns() { Count = (UInt32)(colMax - colMin + 1) };
for (int i = 0; i < (colMax - colMin + 1); i++)
{
tableColumns.Append(new TableColumn() { Id = (UInt32)(i + 1), Name = "Column" + i });
}

TableStyleInfo tableStyleInfo = new TableStyleInfo() { Name = "TableStyleLight1", ShowFirstColumn = false, ShowLastColumn = false, ShowRowStripes = true, ShowColumnStripes = false };

table.Append(autoFilter);
table.Append(tableColumns);
table.Append(tableStyleInfo);

tableDefinitionPart.Table = table;

TableParts tableParts = new TableParts() { Count = (UInt32)1 };
TablePart tablePart = new TablePart() { Id = "rId" + tableNo };

tableParts.Append(tablePart);

worksheetPart.Worksheet.Append(tableParts);
}


I'm not sure why the table is being constructed incorrectly, I would appreciate any help I can get to fix this.



I will also include table1.xml before and after being repaired:
table1.xml Before Repair:



<?xml version="1.0" encoding="utf-8" ?>
<x:table id="1" name="Table1" displayName="Table1" ref="A2:H12"
totalsRowShown="0"
xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<x:autoFilter ref="A2:H12"/>
<x:tableColumns count="8">
<x:tableColumn id="1" name="Column0"/>
<x:tableColumn id="2" name="Column1"/>
<x:tableColumn id="3" name="Column2"/>
<x:tableColumn id="4" name="Column3"/>
<x:tableColumn id="5" name="Column4"/>
<x:tableColumn id="6" name="Column5"/>
<x:tableColumn id="7" name="Column6"/>
<x:tableColumn id="8" name="Column7"/>
</x:tableColumns>
<x:tableStyleInfo name="TableStyleLight1" showFirstColumn="0"
showLastColumn="0" showRowStripes="1" showColumnStripes="0"/>
</x:table>


table1.xml After Repair:



<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision"
xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3"
mc:Ignorable="xr xr3" xr:uid="{00000000-000C-0000-FFFF-FFFF00000000}" id="1"
name="Table1" displayName="Table1" ref="A2:H12" totalsRowShown="0">
<autoFilter xr:uid="{00000000-0009-0000-0100-000001000000}" ref="A2:H12"/>
<tableColumns count="8">
<tableColumn xr3:uid="{00000000-0010-0000-0000-000001000000}" id="1"
name="Column0"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000002000000}" id="2"
name="Column1"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000003000000}" id="3"
name="Column2"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000004000000}" id="4"
name="Column3"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000005000000}" id="5"
name="Column4"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000006000000}" id="6"
name="Column5"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000007000000}" id="7"
name="Column6"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000008000000}" id="8"
name="Column7"/>
</tableColumns>
<tableStyleInfo name="TableStyleLight1" showFirstColumn="0"
showLastColumn="0" showRowStripes="1" showColumnStripes="0"/>
</table>


Thanks in advance.










share|improve this question























  • have you tried using your debugger to step through the code?

    – JohnB
    Nov 23 '18 at 3:55











  • Yes, I tried using my debugger, and didn't find the issue. I tried adding 3 tables to 2 different sheets in one spreadsheet, and I noticed that the repaired records were for tables 1 to 6. This makes me think I might need to change TableIds from 1-3 on sheet 1 and 1-3 on sheet 2, to 1-3 on sheet 1 and 4-6 on sheet 2.

    – Jacob Carrol
    Nov 23 '18 at 5:16











  • I recommend you use the Open XML SDK Productivity Tool to track down the problem in your code. Create a minimal workbook that has the problem. Open the workbook, let Excel repair it, then save as to a different name. Open the repaired workbook and look at the code the Tool proposes to create it. Compare that with your current code. It might also help to open the "bad" workbook in the Tool then use the "Compare" functionality to compare it to the "good" version.

    – Cindy Meister
    Nov 23 '18 at 11:33














0












0








0








I'm creating multiple spreadsheets (separate files), each containing multiple sheets, and when I open the output file of one of these spreadsheets in excel it asks if I want to repair it (this only happens when I add tables), and shows what was repaired:



Repaired Records: Table from /xl/tables/table1.xml part (Table)


After repairing, the file is in the correct format, but as this is being automated I can't reply on using excel to repair these files. It only causes this problem when I create a table.



For example: I call the Define Table method using the following parameters to create a table of 11 Rows (Rows 2-12 inclusive) and 8 Columns (1-8 inclusive):



DefineTable(worksheetPart, 2, 12, 1, 8);


The DefineTable method is shown below:



private static void DefineTable(WorksheetPart worksheetPart, int rowMin, int rowMax, int colMin, int colMax)
{
TableDefinitionPart tableDefinitionPart = worksheetPart.AddNewPart<TableDefinitionPart>("rId" + (worksheetPart.TableDefinitionParts.Count() + 1));
int tableNo = worksheetPart.TableDefinitionParts.Count();

string reference = ((char)(64 + colMin)).ToString() + rowMin + ":" + ((char)(64 + colMax)).ToString() + rowMax;

Table table = new Table() { Id = (UInt32)tableNo, Name = "Table" + tableNo, DisplayName = "Table" + tableNo, Reference = reference, TotalsRowShown = false };
AutoFilter autoFilter = new AutoFilter() { Reference = reference };

TableColumns tableColumns = new TableColumns() { Count = (UInt32)(colMax - colMin + 1) };
for (int i = 0; i < (colMax - colMin + 1); i++)
{
tableColumns.Append(new TableColumn() { Id = (UInt32)(i + 1), Name = "Column" + i });
}

TableStyleInfo tableStyleInfo = new TableStyleInfo() { Name = "TableStyleLight1", ShowFirstColumn = false, ShowLastColumn = false, ShowRowStripes = true, ShowColumnStripes = false };

table.Append(autoFilter);
table.Append(tableColumns);
table.Append(tableStyleInfo);

tableDefinitionPart.Table = table;

TableParts tableParts = new TableParts() { Count = (UInt32)1 };
TablePart tablePart = new TablePart() { Id = "rId" + tableNo };

tableParts.Append(tablePart);

worksheetPart.Worksheet.Append(tableParts);
}


I'm not sure why the table is being constructed incorrectly, I would appreciate any help I can get to fix this.



I will also include table1.xml before and after being repaired:
table1.xml Before Repair:



<?xml version="1.0" encoding="utf-8" ?>
<x:table id="1" name="Table1" displayName="Table1" ref="A2:H12"
totalsRowShown="0"
xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<x:autoFilter ref="A2:H12"/>
<x:tableColumns count="8">
<x:tableColumn id="1" name="Column0"/>
<x:tableColumn id="2" name="Column1"/>
<x:tableColumn id="3" name="Column2"/>
<x:tableColumn id="4" name="Column3"/>
<x:tableColumn id="5" name="Column4"/>
<x:tableColumn id="6" name="Column5"/>
<x:tableColumn id="7" name="Column6"/>
<x:tableColumn id="8" name="Column7"/>
</x:tableColumns>
<x:tableStyleInfo name="TableStyleLight1" showFirstColumn="0"
showLastColumn="0" showRowStripes="1" showColumnStripes="0"/>
</x:table>


table1.xml After Repair:



<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision"
xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3"
mc:Ignorable="xr xr3" xr:uid="{00000000-000C-0000-FFFF-FFFF00000000}" id="1"
name="Table1" displayName="Table1" ref="A2:H12" totalsRowShown="0">
<autoFilter xr:uid="{00000000-0009-0000-0100-000001000000}" ref="A2:H12"/>
<tableColumns count="8">
<tableColumn xr3:uid="{00000000-0010-0000-0000-000001000000}" id="1"
name="Column0"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000002000000}" id="2"
name="Column1"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000003000000}" id="3"
name="Column2"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000004000000}" id="4"
name="Column3"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000005000000}" id="5"
name="Column4"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000006000000}" id="6"
name="Column5"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000007000000}" id="7"
name="Column6"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000008000000}" id="8"
name="Column7"/>
</tableColumns>
<tableStyleInfo name="TableStyleLight1" showFirstColumn="0"
showLastColumn="0" showRowStripes="1" showColumnStripes="0"/>
</table>


Thanks in advance.










share|improve this question














I'm creating multiple spreadsheets (separate files), each containing multiple sheets, and when I open the output file of one of these spreadsheets in excel it asks if I want to repair it (this only happens when I add tables), and shows what was repaired:



Repaired Records: Table from /xl/tables/table1.xml part (Table)


After repairing, the file is in the correct format, but as this is being automated I can't reply on using excel to repair these files. It only causes this problem when I create a table.



For example: I call the Define Table method using the following parameters to create a table of 11 Rows (Rows 2-12 inclusive) and 8 Columns (1-8 inclusive):



DefineTable(worksheetPart, 2, 12, 1, 8);


The DefineTable method is shown below:



private static void DefineTable(WorksheetPart worksheetPart, int rowMin, int rowMax, int colMin, int colMax)
{
TableDefinitionPart tableDefinitionPart = worksheetPart.AddNewPart<TableDefinitionPart>("rId" + (worksheetPart.TableDefinitionParts.Count() + 1));
int tableNo = worksheetPart.TableDefinitionParts.Count();

string reference = ((char)(64 + colMin)).ToString() + rowMin + ":" + ((char)(64 + colMax)).ToString() + rowMax;

Table table = new Table() { Id = (UInt32)tableNo, Name = "Table" + tableNo, DisplayName = "Table" + tableNo, Reference = reference, TotalsRowShown = false };
AutoFilter autoFilter = new AutoFilter() { Reference = reference };

TableColumns tableColumns = new TableColumns() { Count = (UInt32)(colMax - colMin + 1) };
for (int i = 0; i < (colMax - colMin + 1); i++)
{
tableColumns.Append(new TableColumn() { Id = (UInt32)(i + 1), Name = "Column" + i });
}

TableStyleInfo tableStyleInfo = new TableStyleInfo() { Name = "TableStyleLight1", ShowFirstColumn = false, ShowLastColumn = false, ShowRowStripes = true, ShowColumnStripes = false };

table.Append(autoFilter);
table.Append(tableColumns);
table.Append(tableStyleInfo);

tableDefinitionPart.Table = table;

TableParts tableParts = new TableParts() { Count = (UInt32)1 };
TablePart tablePart = new TablePart() { Id = "rId" + tableNo };

tableParts.Append(tablePart);

worksheetPart.Worksheet.Append(tableParts);
}


I'm not sure why the table is being constructed incorrectly, I would appreciate any help I can get to fix this.



I will also include table1.xml before and after being repaired:
table1.xml Before Repair:



<?xml version="1.0" encoding="utf-8" ?>
<x:table id="1" name="Table1" displayName="Table1" ref="A2:H12"
totalsRowShown="0"
xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<x:autoFilter ref="A2:H12"/>
<x:tableColumns count="8">
<x:tableColumn id="1" name="Column0"/>
<x:tableColumn id="2" name="Column1"/>
<x:tableColumn id="3" name="Column2"/>
<x:tableColumn id="4" name="Column3"/>
<x:tableColumn id="5" name="Column4"/>
<x:tableColumn id="6" name="Column5"/>
<x:tableColumn id="7" name="Column6"/>
<x:tableColumn id="8" name="Column7"/>
</x:tableColumns>
<x:tableStyleInfo name="TableStyleLight1" showFirstColumn="0"
showLastColumn="0" showRowStripes="1" showColumnStripes="0"/>
</x:table>


table1.xml After Repair:



<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision"
xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3"
mc:Ignorable="xr xr3" xr:uid="{00000000-000C-0000-FFFF-FFFF00000000}" id="1"
name="Table1" displayName="Table1" ref="A2:H12" totalsRowShown="0">
<autoFilter xr:uid="{00000000-0009-0000-0100-000001000000}" ref="A2:H12"/>
<tableColumns count="8">
<tableColumn xr3:uid="{00000000-0010-0000-0000-000001000000}" id="1"
name="Column0"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000002000000}" id="2"
name="Column1"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000003000000}" id="3"
name="Column2"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000004000000}" id="4"
name="Column3"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000005000000}" id="5"
name="Column4"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000006000000}" id="6"
name="Column5"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000007000000}" id="7"
name="Column6"/>
<tableColumn xr3:uid="{00000000-0010-0000-0000-000008000000}" id="8"
name="Column7"/>
</tableColumns>
<tableStyleInfo name="TableStyleLight1" showFirstColumn="0"
showLastColumn="0" showRowStripes="1" showColumnStripes="0"/>
</table>


Thanks in advance.







c# excel openxml-sdk






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 23 '18 at 3:32









Jacob CarrolJacob Carrol

1




1













  • have you tried using your debugger to step through the code?

    – JohnB
    Nov 23 '18 at 3:55











  • Yes, I tried using my debugger, and didn't find the issue. I tried adding 3 tables to 2 different sheets in one spreadsheet, and I noticed that the repaired records were for tables 1 to 6. This makes me think I might need to change TableIds from 1-3 on sheet 1 and 1-3 on sheet 2, to 1-3 on sheet 1 and 4-6 on sheet 2.

    – Jacob Carrol
    Nov 23 '18 at 5:16











  • I recommend you use the Open XML SDK Productivity Tool to track down the problem in your code. Create a minimal workbook that has the problem. Open the workbook, let Excel repair it, then save as to a different name. Open the repaired workbook and look at the code the Tool proposes to create it. Compare that with your current code. It might also help to open the "bad" workbook in the Tool then use the "Compare" functionality to compare it to the "good" version.

    – Cindy Meister
    Nov 23 '18 at 11:33



















  • have you tried using your debugger to step through the code?

    – JohnB
    Nov 23 '18 at 3:55











  • Yes, I tried using my debugger, and didn't find the issue. I tried adding 3 tables to 2 different sheets in one spreadsheet, and I noticed that the repaired records were for tables 1 to 6. This makes me think I might need to change TableIds from 1-3 on sheet 1 and 1-3 on sheet 2, to 1-3 on sheet 1 and 4-6 on sheet 2.

    – Jacob Carrol
    Nov 23 '18 at 5:16











  • I recommend you use the Open XML SDK Productivity Tool to track down the problem in your code. Create a minimal workbook that has the problem. Open the workbook, let Excel repair it, then save as to a different name. Open the repaired workbook and look at the code the Tool proposes to create it. Compare that with your current code. It might also help to open the "bad" workbook in the Tool then use the "Compare" functionality to compare it to the "good" version.

    – Cindy Meister
    Nov 23 '18 at 11:33

















have you tried using your debugger to step through the code?

– JohnB
Nov 23 '18 at 3:55





have you tried using your debugger to step through the code?

– JohnB
Nov 23 '18 at 3:55













Yes, I tried using my debugger, and didn't find the issue. I tried adding 3 tables to 2 different sheets in one spreadsheet, and I noticed that the repaired records were for tables 1 to 6. This makes me think I might need to change TableIds from 1-3 on sheet 1 and 1-3 on sheet 2, to 1-3 on sheet 1 and 4-6 on sheet 2.

– Jacob Carrol
Nov 23 '18 at 5:16





Yes, I tried using my debugger, and didn't find the issue. I tried adding 3 tables to 2 different sheets in one spreadsheet, and I noticed that the repaired records were for tables 1 to 6. This makes me think I might need to change TableIds from 1-3 on sheet 1 and 1-3 on sheet 2, to 1-3 on sheet 1 and 4-6 on sheet 2.

– Jacob Carrol
Nov 23 '18 at 5:16













I recommend you use the Open XML SDK Productivity Tool to track down the problem in your code. Create a minimal workbook that has the problem. Open the workbook, let Excel repair it, then save as to a different name. Open the repaired workbook and look at the code the Tool proposes to create it. Compare that with your current code. It might also help to open the "bad" workbook in the Tool then use the "Compare" functionality to compare it to the "good" version.

– Cindy Meister
Nov 23 '18 at 11:33





I recommend you use the Open XML SDK Productivity Tool to track down the problem in your code. Create a minimal workbook that has the problem. Open the workbook, let Excel repair it, then save as to a different name. Open the repaired workbook and look at the code the Tool proposes to create it. Compare that with your current code. It might also help to open the "bad" workbook in the Tool then use the "Compare" functionality to compare it to the "good" version.

– Cindy Meister
Nov 23 '18 at 11:33












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53440352%2fopenxml-table-creation-how-do-i-create-tables-without-requiring-excel-to-repa%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53440352%2fopenxml-table-creation-how-do-i-create-tables-without-requiring-excel-to-repa%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

To store a contact into the json file from server.js file using a class in NodeJS

Redirect URL with Chrome Remote Debugging Android Devices

Dieringhausen