Posted 12 years ago by Dan - Software dev., IBM Global sevices / Rational Software
Version: 4.0.0258
Avatar
I am using the syntax editor control to do syntax highlighting in our application & I want the user to be able to save the current document to a file.
I am using the following code to save the document:
SaveFileDialog sfd = new SaveFileDialog();
                    sfd.Filter = "Web Page (*.html)|*.html|Rich Text Format (*.rtf)|*.rtf|Plain Text Unicode Format (*.txt)|*.txt";

if (DialogResult.OK == sfd.ShowDialog())
                    {
                        switch (sfd.FilterIndex)
                        {
                            case 1:
                                
                                syntaxEditorControl.Document.SaveFileAsHtml(sfd.FileName + ".Html", HtmlExportType.ClassBased, LineTerminator.CarriageReturnNewline);
                                break;

                            case 2:
                                syntaxEditorControl.Document.SaveFileAsRtf(sfd.FileName + ".Rtf", syntaxEditorControl.Font, LineTerminator.CarriageReturnNewline);
                                break;

                            case 3:
                                syntaxEditorControl.Document.SaveFile(sfd.FileName + ".Txt", Encoding.Unicode, LineTerminator.CarriageReturnNewline);
                                break;
                        }
                    }
When saving to an HTML document it is written inside of the "View Source" the following:

<title>Actipro SyntaxEditor Document Text</title>
Code highlighting produced by Actipro SyntaxEditor
http://www.ActiproSoftware.com/Products/DotNet/



How can we tell the control not to write these strings ?

Comments (6)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Dan,

We've added overloads to the HTML export methods for you that let you set a custom title. This will be in the upcoming maintenance release.

For the other portion, that is in a comment so it isn't visible to the end user.


Actipro Software Support

Posted 12 years ago by Dan - Software dev., IBM Global sevices / Rational Software
Avatar
We know that it won't be visible to the user but we already include Actipro in the "About" dialog of our application and we don't need to show the included library of each module in the code.
This is not a big problem but it would be nice if we will be able to control this text.

Dan
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
You could pull it out manually by calling Document.GetTextAsHtml and then remove it from that string and save the string to a file. Our document save as HTML code essentialy calls the GetTextAsHtml method and writes the output directly to a file.


Actipro Software Support

Posted 12 years ago by Dan - Software dev., IBM Global sevices / Rational Software
Avatar
We thought about it but we dont get any event like SaveEnded so in we need to wait and check that the operation is finished before doing it.
Is there away to do it via reflection ?
I searched with reflector (Lutz Roder's .Net reflector) for these strings but I can't find them.

-Dan
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I was saying call Document.GetTextAsHtml instead, get the result in a string. Modify the string to remove that comment. Then use the System.IO classes to write the string out to your destination file.


Actipro Software Support

Posted 12 years ago by Dan - Software dev., IBM Global sevices / Rational Software
Avatar
OK...
Great

thanks,

Dan
The latest build of this product (v2018.1 build 0341) was released 7 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.