Textbox Rotation Or Display Horizontal Vs Vertical (and WRAPPING)
Mar 26, 2008
Hello I was very happy to have found the thread http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=491642&SiteID=1 that explained how to get the text to display Bottom-to-Top/Left-to-Right.
The solution was to setup a function that creates a bitmap the text to be displayed.
This works well and correctly displays the text image in HTML and PDF. (Excel, XML and CVS won't export backgroud images).
To extend the solution to wrap text it requires a few additional lines...
Code Snippet
Function LoadImage3(ByVal stText As String)
stText = stText.PadRight(10)
stText = stText.PadLeft(10)
Dim iMaxLength as Integer = 180
Dim iMaxWidth as Integer = 180
Dim f As Drawing.Font = New Drawing.Font("Arial",7, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point)
Dim bmpImage As New Drawing.Bitmap(1, 1)
Dim MyGraphics As Drawing.Graphics = Drawing.Graphics.FromImage(bmpImage)
Dim imageSize As Drawing.SizeF = MyGraphics.MeasureString(stText, f)
Dim i As New System.Drawing.Bitmap(iMaxWidth, iMaxLength)
Dim g As Drawing.Graphics = Drawing.Graphics.FromImage(i)
Dim rectF1 As New Drawing.Rectangle(-(iMaxWidth/2),-(iMaxLength/2),iMaxWidth,iMaxLength )
g.FillRectangle(Drawing.Brushes.White, 0, 0, i.Width, i.Height)
g.TranslateTransform((iMaxWidth/2), (iMaxLength/2) )
g.RotateTransform(270.0F) 'flip the image 270 degrees
g.DrawString(stText, f,Drawing.Brushes.Black, rectF1)
g.DrawRectangle(New Drawing.Pen(Drawing.Color.White, 1), rectF1)
g.Flush()
Dim stream As IO.MemoryStream = New IO.MemoryStream
Dim bitmapBytes As Byte()
i.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg) 'Create bitmap
bitmapBytes = stream.ToArray
stream.Close()
i.Dispose()
Return bitmapBytes
End Function
Items highlighted in yellow reflect changes made to orignal solution.
Is it possible to align a text box to display text with rotation? For example can I display it rotated 90 degrees left so that it reads from the bottom towards the top of the page? All I can find is left/right alignment and top/middle/bottom alignment. I want to rotate the text.
I have a query that calculates sales by sales person, but it displays horizontally across my query window. Is their a way in SQL Server to have the data display vertically down the window instead?
This is my current query
Code:
Select count(case when salesman Like 'Geo%' then id else null end) As [George] ,count(case when salesman Like 'Li%' then id else null end) As [Lisa] ,count(case when salesman Like 'Jor%' then id else null end) As [Jorge] ,count(case when salesman Like 'Ri%' then id else null end) As [Richard] ,count(case when salesman Like 'Geo%' then id else null end)+count(case when salesman Like 'Li%' then id else null end) As [Team 1 Sales] ,count(case when salesman Like 'Jor%' then id else null end)+count(case when salesman Like 'Ri%' then id else null end) As [Team 2 Sales] from sales.southeastregion
Which of course shows the results as such
George --- Lisa --- Jorge --- Richard --- Team 1 --- Team 2 100 50 10 90 150 100
And I want the data to be displayed like
George - 100 Lista - 50 Jorge - 10 Richard - 90 Team 1 - 150 Team 2 - 100
I'm running SQL Server 2008 Standard.I need to create a query that has data from multiple columns (Columns 1-6 with coresponding Date started and Date Completed data) displayed vertically, but also has the column name the preeceeding column to identify it...along with other data (Record number, status).
factory2 goods 1kg 5.50 factory2 goods 2kg 6.20 and so on for all factories.
I tried with UNPIVOT but it does not allow it (I'm using Navicat 8), saying "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near UNPIVOT...".
I have a table as follows opendate (datetime) callnumber (int) closed (bit)
I want to find how many calls were opened today and of those how many are closed
I have come up with the code below but again am looking for 1. a more elegant solution 2. a way to generalise this to show the same information for x number of days
create table #holdit1 (opencount int)
create table #holdit2 (closedcount int)
insert into #holdit1 SELECT count(*) as opencount FROM [dbo].[problog] WHERE datediff(dd, opendate, getdate()) = 0 AND closed = 0 group by closed
insert into #holdit2 SELECT count(*) as closedcount FROM [dbo].[problog] WHERE datediff(dd, opendate, getdate()) = 0 AND closed = 1 group by closed
select #holdit1.opencount AS CallsOpen, #holdit2.closedcount AS CallsClosed, #holdit1.opencount + #holdit2.closedcount AS AllCalls from #holdit1 cross join #holdit2 #holdit2
DROP TABLE #holdit1 DROP TABLE #holdit2
this gives me CallsOpen CallsClosed AllCalls ----------- ----------- ----------- 1 3 4
To the following Cust______1______3______4______6______9______11 __________________________________________________ __________ 1_______Bike___________Blue__No ENsur_________ 2_______car____silver_________________Ens____Yes"
Above is the query of the result I want to show this resultset horizontaly for that I have to use the cursor such that @M1=Where Milestone=1 @M2=Where Milestone=2 @M3=Where Milestone=3 and putting this into a temp table with its projectid and taskid. Plz guide me that how to achiev this exactly Swati
I developed a report with some values in textboxes. I want the output not to wrap around to the next line but to be truncated if it is more that the size of the textbox. Is there any setting that i can do b/c values are going to the second line when their size is more like printing name and last name will cause last name to go to the second line ?
Following is my table and its content:YearTargetedBudgetFirstQuarterSecondQuarterThirdQuarter-----------------------------------------------------------------------------------------------------20002500012000110001000200135000220002100020002002450003200031000300020035500042000410004000I want a query which returns the result in this format:Yr_Col1Yr_Col2Yr_Col3Yr_Col4----------------------------------------------------20002001200220032500035000450005500012000220003200042000110002100031000410001000200030004000There could be many work around, but what would be fasted single queryfor this?
Could anybody tell me how to convert vertical data into horizontal data?I have a one-to-many relationship in sql server 2KProduct, ProductAccessory, one Product has many ProductAccessories.My Table design is like this:Table Product{ ProdId int, ProdNameId int, ....}Table ProductAccessory{ ProdId int, AccNameId int, AccUnitId int, ....}Because one Production has at most 4 ProductAccessoryI want to use a SELECT statement OR function to return ProdId, ProdNameId, AccNameId1, AccUnitId1, AccNameId2, AccUnitId2, AccNameId3, AccUnitId3, ....Any help will be appreciated! Thanks a lotJoseph
Hi All, Any assistance would be greatly appreciated.
I have a current table which I create on a regular basis from a text file with a layout similar to this: TypePolicy #AmountRider 1 AmtRider 2 Amt B1112H24.341212.34
This text file is brought into a staging table with each field (even the amount field) as a varchar (12). I then assign types in a later step in my DTS package.
What I need to do is stack the riders under each policy so for each policy where there is a rider, there is a new row for every rider. So in the example I've given, there would be 2 additional rows for the original first row since there are two riders. TypePolicy #Amount B1112H24.34 R11112H12 R21112H12.34
I plan on doing this by first creating a table with just the Type, Policy #, and Amt fields, and then using a series of insert queries where I take the rider (if there is one) and append it onto the table.
However, I'm getting the following error message when I try: Server: Msg 213, Level 16, State 4, Line 1 Insert Error: Column name or number of supplied values does not match table definition.
Basically, it wouldn't let me put an 'R1' in the Type column. How can I get this to work!?!?
I liked the default appearance of SSMS in 2005 and 2008. 2012 is lousy by default.
My quesion is whether it can be made to approximate the way it behaved in 2008.
What I liked: Registered Servers and Object Explorer resided on nested vertical tabs on the left-hand side of the screen. Queries stacked up on the right-hand side of the screen.
I managed to get the Registered Servers and Object explorer to display with nested vertical tabs (tabs at the top, rather than the bottom - that's ok). But if there aren't any other vertical tabbed displays, then the tab on top fills the screen. There's no point to that. Both Registered Servers and Object explorer are narrow trees. The rest of the screen is white nothingness.
If a query is opened, it then fills the screen - empty. If I want that in a vertical tab I have to manually make it one (right click, choose New Vertical Tab Group).
s there a way to make the doggone thing behave?
The way I got the Registered Servers and Object explorer to behave this way was to right click on a tab and play with the vertical tabbing options.
I would like to display a couple of records horizontally via a table or list, but don't think this is possible. Am I right? The given recordset should only have two records and the formatting would be much better if they were displayed left to right rather than one on top of the other. Is this just not possible with SSRS? Thanks,
I have a single column returned from a select statement. How can I have this returned as a vertical string? I looked into using PIVOT but my scenario seems too simple to use Pivot. I'm not requiring any aggregate functions or anything.
I need to find out how to display, edit and save SQL information using Visual Basic. I can create an SQL database and spreadsheet, but do not know how to incroporate it into my project, and make certain pieces of the information (certain cells) appear in the labels or textboxes that I designate in my VB Project.
I'm trying to create a reprot with 30+ datasets/querys. My report is made up of tables (one for each dataset), and it starts a new page whenever a new dataset is being displayed. I would like to have a header on every page, and have it display a custom name for the dataset on that page. How do I approach this? Thanks for any answers or leads.
The table describes the tire and also the history of movement of the tire from one tire_position to another on same or a different truck. I need to capture the rotation of the tire. Rotation can be captured from changes in tire_position or changes in Truck_ID columns.
Rotation frequency is 0 if both tire_position and truck_ID stay thesame till the tire is scrapped (disposition_to = C )
If only one of them changes, rotation frequency is count the number of times it changes
If both change, rotation frequency is the maximum of the count of the two. So if truck_ID changes 2 times and tire_position changes 3 times. The rotation frequency is 3.
Obviously, if both change same number of times, rotation frequency can be coun anyone of them.
So I need to have a new column added to this table for the rotation frequency.
Checking them manually, the rotation frequency for the each serial_number is: 2361 is 4, 4853 is 3, 3007 is 1, 2743 is 2, 3949 is 2, 3995 is 2, 5666 is 1.
I have a SQL Server that generates a reasonable amount of log data in the SQL Event logs. I'm finding it difficult to use this data as the individual log files become rather large i.e. several hundred MB before they rotate.
What I would like to achieve: Set a constraint like: Each log will rotate when it reaches [XX]Mb in size and the files will be kept through [Y] rotations.
I can't seem to find how to do this through Enterprise Manager. I've had a decent look through google and there seems to be no info on this forum....can anyone point me in the right direction?
I am a newbie in using MS SQL server with analysis services. There seems to be no 'cross-validation' tool in MS SQL which is frequently used in data mining and even statistics. Is there anyone having similar difficulties? Is there any solution like a small scripts to divide the given dataset with multiple folds? Your valuable comments and feedbacks would be appreciated.
I am using Enterprise Manager to generate a script of the stored procedures on my database. Under File|Options, I selected Windows Text(ANSI). The file which is generated contains all stored procedures, but there are some procedures which are so long that they wrap to the next line.
When I then try to run this script from ISQL in a batch file, those procedures which wrap error out. Is there any way to generate the script in a more formatted manor, avoiding the wrapping?
In some text boxes within the table header, I want to force the text to wrap. This would be comparable to using Alt+Enter in Excel. For example, the text box may read like this...
I have a report that contains a table. I would like the table to wrap to a second column on the report page to decrease the number of pages the report spans. Is there a way to tell the table to span to the second column before going onto the next page?