Hi,
Is there a way to read from one Excel with Infragistics and output the same data to another Excel, while keeping the exact same formatting as the original? For example, if part of the text has strikethrough (see above, circle added by me) or some of the text is black and some is red, how do I end up with the same visual effect in the new spreadsheet I'm writing to? Thanks!
Alex
Hi Alex,
When you Read an Excel File into a Workbook and then Write that Workbook to an Excel File, any formatting should be preserved.
Please try this and let me know if it works for you.
Hi Mike, thanks for your reply. I tried that before posting. In the sample text at the top of my original posting, the strikethrough does not get preserved. In other cases, when part of the text is red and part of the text is black, the red does not get preserved.
Alex,
I created a simple console app to test the saving of the formatting and the strike through format was preserved in my test. I have attached this sample for your reference.
Please test this sample to see if you have the same behavior. If you see that the formatting isn't preserved, then maybe there is a difference in the versions of the toolset that we are using or another environment detail that is a factor. If this sample works as expected but your source excel file behaves differently, we will need an excel file that does reproduce the behavior that we can use for debugging to see what happens.
Let us know if you have any questions.
ConsoleApp1.zip
Hi Alan,
That did indeed work but my application needs to read just 2 columns from a multi-column spreadsheet and output just those 2 columns to a new spreadsheet so I need to write values to individual cells. Your help is much appreciated. Thank you.
Alan,
After doing some more research I tried your solution coupled with hiding the columns I don't want, and that seems to do the trick. I'm still curious if there is a way to do it while assigning a value to a cell. wRow.Cells[0].Value = whatever (with partial strikethrough).