Answered by:
change font size of files

Question
-
Answers
-
Show VDX656.
Best Regards Martin
- Proposed as answer by litdevModerator Thursday, January 7, 2016 7:32 PM
- Marked as answer by litdevModerator Sunday, January 31, 2016 3:58 PM
-
A text file is a simple text only. There are no properties for FontSize, -Color, etc. These properties you'll have to set from the viewer for the text file (like in GraphicsWindow, Notepad, Browser etc.) To show your text in defined color, size, formating, etc. use Martin's example from above (in GraphicsWindow) resp. as a TextShape (Shapes.AddText) or LDProcess.Start("notepad.exe", txtFile) to open it in Notepad, LDControls.AddBrowser(width, height, ""file:///" + locTxtFile) lets you zoom in/out, or load it into LDControls.AddRichTextBox.
- Edited by Pappa LapubEditor Friday, January 8, 2016 1:15 PM
- Marked as answer by litdevModerator Sunday, January 31, 2016 3:58 PM
-
I agree with Pappa Lapub, rtf is the best way to do simple formatted text, either using Richtextbox or you can actually just output the formatting as text with formatting info.
http://www.biblioscape.com/rtf15_spec.htm
e.g.
{\rtf1\ansi {\fonttbl\f0\fswiss Helvetica;} \f0\pard\qc{\fs45\b LitDev 1.2.4.0 DE Extension API}\par \f0\pard\sb300\shading2000{\fs36\b LD3DView}\par \f0\pard{\fs20 3D Visualisierung im GraphicsWindow.{\line}{\line}Koordinaten haben folgende Richtungen und keinen Bezug zu GraphicsWindow Koordinaten:{\line}X - Links(-) bis Rechts(+){\line}Y - Unten(-) bis Oben(+){\line}Z - Fern(-) bis Nahe(+){\line}{\line}F?r weitere Details zu untergeordneten Methoden s. http://msdn.microsoft.com/library/ms747437.aspx (?bersicht zu 3D-Grafiken).{\line}Folgende Methoden verwenden HelixToolkit (rekompiliert und angepasst f?r SB, http://helixtoolkit.codeplex.com): {\line}LoadModel, AddSphere, AddTube.}\par \f0\pard\sb75{\fs24\b example}\par \f0\pard{\fs20 3D-samples\\*.sb}\par \f0\pard\sb180\shading1000{\fs30\b AddAmbientLight(shapeName,colour) \fs18\b0\i OPERATION}\par \f0\pard{\fs20 F?gt eine umgebende Lichtquelle hinzu (Intern: Light#).}\par \f0\pard\sb75{\fs24\b shapeName}\par \f0\pard{\fs20 Das 3DView Objekt.}\par \f0\pard\sb75{\fs24\b colour}\par \f0\pard{\fs20 Die Lichtfarbe.}\par \f0\pard\sb75{\fs24\b returns}\par \f0\pard{\fs20 Der 3DView Lichtname.}\par }
Save test.rtf.
This is how I create formatted documentation
- Marked as answer by litdevModerator Sunday, January 31, 2016 3:59 PM
All replies
-
Show VDX656.
Best Regards Martin
- Proposed as answer by litdevModerator Thursday, January 7, 2016 7:32 PM
- Marked as answer by litdevModerator Sunday, January 31, 2016 3:58 PM
-
You can read text file with File.ReadLine().
WordPad file (.rtf) is a text file. So, you can read with File.ReadLine().
But Word file (.docx) is zipped text files. So you need to rename .docx to .zip and unzip the .zip file and get word\document.xml to use File.ReadLine().
Nonki Takahashi
-
-
A text file is a simple text only. There are no properties for FontSize, -Color, etc. These properties you'll have to set from the viewer for the text file (like in GraphicsWindow, Notepad, Browser etc.) To show your text in defined color, size, formating, etc. use Martin's example from above (in GraphicsWindow) resp. as a TextShape (Shapes.AddText) or LDProcess.Start("notepad.exe", txtFile) to open it in Notepad, LDControls.AddBrowser(width, height, ""file:///" + locTxtFile) lets you zoom in/out, or load it into LDControls.AddRichTextBox.
- Edited by Pappa LapubEditor Friday, January 8, 2016 1:15 PM
- Marked as answer by litdevModerator Sunday, January 31, 2016 3:58 PM
-
-
To read/load the text content(s) of a text file, as well to save the modified text back to (another) text file, see the Methods in the File Class
To modify/format the loaded text to your needs, see the Methods in the Text Class
resp. LDFile Class and/or LDText Class
For printing you can use LDFile.PrintFile and LDUtilities.ShowPrintPreview
Perhaps make a text search (eg. from notepad) in LitDev.xml for 'Print', to see more 'print' related Methods in LitDev extension.
- Edited by Pappa LapubEditor Tuesday, January 12, 2016 12:50 PM
-
-
In a simple textfile you cannot change fontsize. If you use a wordprocessor (e.g. Word) you can change that sort of things:
There is no need to use Small Basic for this!
Jan [ WhTurner ] The Netherlands
- Edited by WhTurner33Editor Tuesday, January 12, 2016 2:57 PM
-
-
See LDGraphicsWindow.Print or the print settings of yor printer.
Or other solution: LDControls.RichTextBoxSave to rtfDoc, then open the LDProcess.Start("write.exe", rtfDoc) and press "Print'.
resp. LDProcess.Start("shellCommand", rtfDoc)
where shellCommand is "%ProgramFiles%\Windows NT\Accessories\WORDPAD.EXE" /p or "..\system32\write.exe" /p for 'Print' ;
or "%ProgramFiles%\Windows NT\Accessories\WORDPAD.EXE" /pt resp. ..\system32\write.exe /pt for 'PrintTo'.
.. see HKCR\rtffile\shell\print(to)\command
PS: About RichTextBox, LitDev provides a great sample in 'other-samples\RichTextBox.sb'- Edited by Pappa LapubEditor Tuesday, January 12, 2016 5:55 PM
-
I agree with Pappa Lapub, rtf is the best way to do simple formatted text, either using Richtextbox or you can actually just output the formatting as text with formatting info.
http://www.biblioscape.com/rtf15_spec.htm
e.g.
{\rtf1\ansi {\fonttbl\f0\fswiss Helvetica;} \f0\pard\qc{\fs45\b LitDev 1.2.4.0 DE Extension API}\par \f0\pard\sb300\shading2000{\fs36\b LD3DView}\par \f0\pard{\fs20 3D Visualisierung im GraphicsWindow.{\line}{\line}Koordinaten haben folgende Richtungen und keinen Bezug zu GraphicsWindow Koordinaten:{\line}X - Links(-) bis Rechts(+){\line}Y - Unten(-) bis Oben(+){\line}Z - Fern(-) bis Nahe(+){\line}{\line}F?r weitere Details zu untergeordneten Methoden s. http://msdn.microsoft.com/library/ms747437.aspx (?bersicht zu 3D-Grafiken).{\line}Folgende Methoden verwenden HelixToolkit (rekompiliert und angepasst f?r SB, http://helixtoolkit.codeplex.com): {\line}LoadModel, AddSphere, AddTube.}\par \f0\pard\sb75{\fs24\b example}\par \f0\pard{\fs20 3D-samples\\*.sb}\par \f0\pard\sb180\shading1000{\fs30\b AddAmbientLight(shapeName,colour) \fs18\b0\i OPERATION}\par \f0\pard{\fs20 F?gt eine umgebende Lichtquelle hinzu (Intern: Light#).}\par \f0\pard\sb75{\fs24\b shapeName}\par \f0\pard{\fs20 Das 3DView Objekt.}\par \f0\pard\sb75{\fs24\b colour}\par \f0\pard{\fs20 Die Lichtfarbe.}\par \f0\pard\sb75{\fs24\b returns}\par \f0\pard{\fs20 Der 3DView Lichtname.}\par }
Save test.rtf.
This is how I create formatted documentation
- Marked as answer by litdevModerator Sunday, January 31, 2016 3:59 PM
-
-
Carmenello, this is a simple sample. Reference is here.
' simple rich text file editor path = "c:\Users\Nonki\test.rtf" ' Please correct folder name for you GraphicsWindow.BrushColor = "Black" rtbox = LDControls.AddRichTextBox(600, 380) LDControls.RichTextBoxLoad(rtbox, path, "False") Shapes.Move(rtbox, 10, 10) save = Controls.AddButton("Save", 10, 400) s12 = Controls.AddButton("12", 100, 400) s40 = Controls.AddButton("40", 200, 400) Controls.ButtonClicked = OnButtonClicked Sub OnButtonClicked btn = Controls.LastClickedButton If btn = save Then LDControls.RichTextBoxSave(rtbox, path) LDProcess.Start("wordpad.exe", path) ElseIf btn = s12 Then LDControls.RichTextBoxSelection(rtbox) LDControls.RichTextBoxFontSize = 12 ElseIf btn = s40 Then LDControls.RichTextBoxSelection(rtbox) LDControls.RichTextBoxFontSize = 40 EndIf EndSub
Nonki Takahashi
- Edited by Nonki TakahashiModerator Wednesday, June 8, 2016 5:28 AM minor update