Feature request: ToAsciiString() - returns a string without colors and special characters #1125
-
Is your feature request related to a problem? Please describe. When looking at the source, I cannot find an easy way to solve this, and searching API documentation, StackOverflow and issues here turns up nothing. Perhaps there is a simple solution I've missed? Describe the solution you'd like
This would create a custom RenderOptions with ColorSystem = ColorSystem.NoColors and Ansi=false, a default width (overridable) and render the simplest ASCII table. Describe alternatives you've considered Redirecting console output works but feels like overkill, and you cannot use markdown codes (anything that creates ANSI).
Thanks for a great product! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
This can be done by using a Using the static API// Start recording
AnsiConsole.Record();
// Write stuff to the console
AnsiConsole.Write(new Table() ... );
// Get output as string
string text = AnsiConsole.ExportText();
// Export using a custom encoder
string custom = AnsiConsole.Export(new MyOutputEncoder()); Using
|
Beta Was this translation helpful? Give feedback.
-
Thanks Patrik! I will try the Recorder, and if possible build a ToAscii method. |
Beta Was this translation helpful? Give feedback.
This can be done by using a
Recorder
which was designed for this purpose.Using the static API
Using
IAnsiConsole