|
Sorry but this makes no sense. Explain clearly what your program is trying to do, show the actual lines of code (surrounded by <pre> tags so it's readable) and what results you get.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
OK
There is RichTextBox (MyRtb), which content is saved as rtf-file.
Rtf-file contains page formatting data, which I have tried to modify so that the page orientation is Landscape.
I have tried to set Document Formatting Property "\landscape" and
Section Text Property "\lndscpsxn".
Those properties are documented in rtf specification.
Code lines, which I used for setting those properties:
<pre lang="vb">Myrtb.Rtf = "{\rtf1\landscape}"</pre>
<pre lang="vb">Myrtb.Rtf = "{\rtf1\lndscpsxn}"</pre>
Well, it might be that those parameters are not in the right place in rtf-code.
But anyway, it seems that those lines do not affect rtf code at all.
And the main question is: Is it possible at all (in code) to modify rtf-file so that the page orientation is in Landscape mode ?
|
|
|
|
|
Myrtb.Rtf = "{\rtf1\landscape}
Myrtb.Rtf = "{\rtf1\lndscpsxn}
If that is all the code you have I don't see how it can affect anything. Where do you modify the contents of your RTF file before saving it?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
sText is String, which contains text and linefeeds
<pre lang="vb">Myrtb.SelectionColor = Color.Black</pre>
<pre lang="vb">Myrtb.SelectionFont = New Font("Microsoft Sans Serif", 14, FontStyle.Bold, GraphicsUnit.Point)</pre>
<pre lang="vb">Myrtb.SelectedText = sText </pre>
<pre lang="vb">Myrtb.Rtf = "{\rtf1\landscape}</pre>
<pre lang="vb">Myrtb.Rtf = "{\rtf1\lndscpsxn}</pre>
<pre lang="vb">Myrtb.SaveFile(Me.SaveFileDialog.FileName, RichTextBoxStreamType.RichText)</pre>
|
|
|
|
|
Please format your code properly, it only needs one set of tags around it and should appear thus:
Myrtb.SelectionColor = Color.Black
Myrtb.SelectionFont = New Font("Microsoft Sans Serif", 14, FontStyle.Bold, GraphicsUnit.Point)
You also probably need to uncheck the box titled "Treat my content as plain text, not as HTML ".
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
See here[^] for some suggestions as to formatting; it suggests your \landscape command comes before your text.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Ok, thank you.
The only solution offered for this problem in the web is this MS Word solution, and it is quite "rough" programming.
So I wonder if it's possible at all (in code) to set/modify rtf-code part of the rtf-file.
|
|
|
|
|
AFAIK every Windows version includes a copy of WordPad, which natively uses the RTF format. It also is the application associated with the RTF extension until you install something that replaces that association (such as MS Word).
I use RTF a lot, I have classes to generate RTF documents, then open them in WordPad for the user to inspect, modify if necessary, print, etc.
RTF is a complex language, its manual is hundreds of pages. Generating a valid document is quite doable, altering an existing one can be a real challenge.
|
|
|
|
|
The RTF specification is extensive, and programs that accept and/or generate RTF documents pick and choose what subset of commands they use.
I performed a little test using Wordpad 6.0 (on Vista), creating, printing, storing and inspecting a simple RTF file both in portrait and in landscape. My observations include:
- margin information was not stored in the document itself.
- paper orientation was not stored in the document itself.
- both are settings for Wordpad, not for the document; when you open Wordpad, you get what you had last time in Wordpad.
As Wordpad seems to consider these app settings rather than document settings, I expect it will ignore the relevant commands if they were present in the file (I haven't tested this).
FYI: Wordpad can show much more complex RTF documents than it allows the user to create; as an example, it can show tables, graphs, and images; things it doesn't offer the means for to insert in an empty document.
|
|
|
|
|
Thanks for clarifying WordPad behaviour.
So, the WordPad does not care about document page setting.
But, if the user opens document for example with MS Word, then these settings coul be used.
I managed to set the rtf-code by following way. I dont know whether it's clever way or not, but MS Word understood it and opened document in landscape.
The created and saved rtf-file is reopened, page settings are inserted into rtf-code, and finally file is saved again.
Me.rtbPrint.SaveFile(Me.SaveFileDialog.FileName, RichTextBoxStreamType.RichText)
Dim FILE_NAME As String = Me.SaveFileDialog.FileName
Dim objReader As New System.IO.StreamReader(FILE_NAME)
Dim sString = objReader.ReadToEnd
objReader.Close()
sString = sString.Insert(6, "\paperw15840\paperh12240\margl720\margr144\margt720\margb288\lndscpsxn")
Dim objWriter As New System.IO.StreamWriter(FILE_NAME)
objWriter.Write(sString)
objWriter.Close()
Hope, that the code is seen properly.
|
|
|
|
|
I can't comment in any detail on Word as I avoid it as much as I can; I do know Word creates pretty complex output files (whether RTF or HTML), and behaves differently from one version to the next.
FWIW: there are other RTF-compatible programs, such as WordPad++. They might offer the functionality you require without having the complexities and cost of Word.
|
|
|
|
|
I'm trying to create a Ms.Word-like program, but save the document in Microsoft Sql Server.
I got a problem in this XtraRichEdit component, at first the program works nicely, but after i added tollbox named create Home Bars at the top right of RichEditControl, everytime i save the document into database, error occured "Exception has been thrown by the target of an invocation". But the most strange is, when i reopen the program and edit the saved document, everything was saved. I just don't understand why this error occurred when save is completely successful.
If this is bug, would you mind to tell me how to code that Home Bars toolbar manually?
|
|
|
|
|
The exception that's being thrown might have an inner-exception, and there might be something interesting in the stack-trace. If the saving is successful, then it's probably thrown after the saving. Are you creating any objects after you saved the documents?
Bastard Programmer from Hell
|
|
|
|
|
Nah before I added that bars, saving my data into database works perfect.
Obviously my problem is I'm using DevExpress 2010 vol1 and after I upgraded it to 2011, problem solved.
|
|
|
|
|
Hello !
i have a project with VB.net 2010 / Entity framework 4. How can i create a crystal report that include columns from different tables.
Table1 Table2
id1 id2
name value
city date
id1
i want to display on report : value date Name
i can make the query to get records that i need to display on report ,
with report wizard , i have created the crystal report ( CrystalReport1.rpt ) with fields from both 2 tables : value date name.
Now , this is my code :
---------------------------------------------------------------------
Dim report As New ReportDocument
report.Load("c:\Crystalreport1.rpt" )
Dim context As New myEntities
Dim query = From t In context.table2 where ....conditions
Select select t1.value , t1.date , t1.table1.name
report.SetDataSource(query.ToList)
Form1.CrystalReportViewer1.ReportSource = report
------------------------------------------------------------------------------
when the report is open , the columns value and date are filled with values , but the column name is empty.
What can i do ?
thank you.
|
|
|
|
|
You can use joins to retrieving values from both tables.
Why to worry when we have powerful joins in hand
|
|
|
|
|
i dont have problem to get records , i have problems to display data in report
|
|
|
|
|
Hi,
This is my very first post on here - so hello!
I graduated in 2007 with a 3rd class degree (I know, a poor result) in Computer Science. On friday, I have my first ever interview for a VB software developer position (I spent some time travelling after graduating, then did a teacher training course which lasted 2 years). I've tried to make up for the fact its a while since I graduated by reading up on programmings languages and practicing in my own time because I have forgotten a lot of it.
Any pointers with what I can expect in the interview? Will it just be the usual questions (why do I want to work for them, what are my strengths/weaknesses etc...) or am I likely to be tested on my knowledge of programming (e.g. what is a method? How would you code this?).
Knowledge of SQLServer is required too. I've only used MySQL - will SQLServer be easy to pick up or is it completely different?
Although its my first interview for a software developer job, I've had interviews for other jobs (mostly teaching). This is my 16th interview since June so I'm very nervous!
Appreciate any help or pointers. Thank you.
|
|
|
|
|
It's almost impossible to guess what questions you may get asked, as it all depends on the job description and the person doing the interviewing. I would prepare by doing some research into the company that is offering the post so you can answer some sensible questions about why you want to work there and where you see yourself in 2, 5, etc. years. Also make sure you are up to date with your VB knowledge and how it is used in whatever areas the developer job is targetted at. Dress smartly, act interested and above all, be honest and prepared to learn from the experience.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I echo what Richard has stated. Another thing is continue to pursue learning. Such as myself with many years of coding experience I don't admit that I know everything, but I am willing to learn everything by studying new things often. (Not to sound like a suck up, but this site has some really good articles to improve your coding. Hence, why many developers visit this site so often.)
One final advice I would like to leave you with that would apply to any field is... know yourself. Be confident in who you are and everything else will fall into place.
My 2 cents. Go show them what you are made of!
|
|
|
|
|
Depends on the interviewer.
If it is someone within the profession then they will probably ask some pertinent and salient questions, if it is a Human Racehorses flunky then probably just the usual old guff will come up.
Just be confident and positive and show a willingness to work, that is usually enough.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
Hi,
After tested with ComboBox, TextBox, Button as DataGrid child controls (Using DataGrid1.Controls.Add), I found that when all arrow keys pressed were capture by the DataGrid. I.e.:
- When I click on the ComboBox and then use the arrow (Up or Down) keys to move through the ComboBox items, the DataGrid1 handles it and I cannot move in the ComboBox, the ComboBox close its drop-down list, lost focus. Additionally, the DataGrid move to another item of its
- When set focus on the button or text box and then use the arrow keys, the same as above happened
I don't know why. I just want to know why, the root cause. Are there any formal documents said that, please show me.
Thanks in advance!
|
|
|
|
|
the problem is, i'm using DevExpress component and i'm trying to change column time format from 08:16:23.1408999 into 08:16:23.
i changed the format string into HH:mm:ss and format type into datetime but seven digit from the back isn't dissappear.
any idea?
|
|
|
|
|
Give this a shot and let me know if this works for you.
Date.Now.ToString("hh:mm:ss")
By the way I think the string format is case sensitive. Not a 100% sure on that, but when I tried "HH:MM:SS" it gave me the correct values except for the seconds which came back as "SS" instead of an actual number. Once I put the format in lower case it worked just fine.
Look at the Date Time example code from MSDN.
|
|
|
|
|
it is entirely case-sensitive.
Examples: MM is a month number, mm is a minute count, HH is hours in 24 hour format, hh is in 12-hour format.
MSDN holds all the details.
|
|
|
|