Can I paste rich text and preserve formatting?

3

I have an Excel sheet and I paste text into a text box. I'm trying to copy+paste a source code from Eclipse and to preserve syntax highlighting and preserve tabs (code formatting).

Syntax highlighting - works fine by using: context menu -> Paste options -> Keep Source Formatting. But this options ruins my code formatting because I can see that excel removes automatically all leading tabs, so my code, pasted into excel text box, is not formatted anymore.

Anyone knows how to preserve code formatting while pasting into text box?

adaslaw

Posted 2013-04-19T15:14:34.980

Reputation: 63

Answers

2

I just tested this with Visual Studio so it may slightly different from Eclipse. When you say text box I also assume you mean a single Excel cell. From Visual Studio Excel would only allow pasting of text. I then pasted the code into Word which preserves formatting and the highlighting. Copying the text from Word and then pasting into Excel seemed to preserve both the syntax and format.

I will say that while Excel can do a bunch of things it may not be the best tool to use for everything. It's hard to say without knowing more about your specific case but another tool might be better for preserving code format.

Brad Patton

Posted 2013-04-19T15:14:34.980

Reputation: 9 939