I am trying to convert excel to text. But I need to get formulas instead of calculated text. How is it possible. Please check the code I am using
Workbook oWorkbook = new Workbook(txtPath.Text);
WorksheetCollection wsc = oWorkbook.Worksheets;
FileStream fsFile;
TxtSaveOptions opts = new TxtSaveOptions();
opts.Separator = ’ ';
for (int i = 0; i < wsc.Count; i++)
{
fsFile = new FileStream(txtPath.Text + “.txt”, FileMode.Append);
try
{
wsc.ActiveSheetIndex = i;
oWorkbook.Save(fsFile, opts);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, “Sheet Error”);
}
finally
{
fsFile.Flush();
fsFile.Close();
}
}
Can you please let me know how to achieve the output.
Examples attached.
Input: Test.xls
Output: Test.xls.txt
Required Output: Test.xls_RequiredOutput.txt
<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-IN</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>
<![endif]–>