|
I have a requirement to convert multiple XML files to Excel files using VBScript. I have used the below script to convert the XML files, but on creation of the Excel files I encouter this:
(a)The column names are getting created with the full path like "/Report/Answers/Answer/Answer"
(b)There are additional fields for aggregation like "/Report/Answers/Answer/Answer/#agg"
(c)The column names are displayed in the reverse order i.e. bottom to top level.
The Script is as mentioned below:
Dim xlApp, xlWkb, SourceFolder,TargetFolder,file
Set xlApp = CreateObject("excel.application")
set fs = CreateObject("Scripting.FileSystemObject")
Const xlNormal=1
SourceFolder="c:\temp\XMLfiles"
TargetFolder="c:\temp\XLSfiles"
'Hide Excel
xlApp.Visible = false
'Process each file in SourceFolder
for each file in fs.GetFolder(SourceFolder).files
'Open file in SourceFolder
Set xlWkb = xlApp.Workbooks.Open(file)
'Get Filename
BaseName= fs.getbasename(file)
'Concatenate full path. Extension will be automatically added by Excel
FullTargetPath=TargetFolder & "\" & BaseName
'Save as XLS file into TargetFolder
xlWkb.SaveAs FullTargetPath, xlNormal
'Close file
xlWkb.close
next
Set xlWkb = Nothing
Set xlApp = Nothing
Set fs = Nothing
Kindly let me know your inputs to modify the code to display the column names alone and also to remove the agg columns that are generated.
|
|
|
|
|
Dear all members,
Recently i build a small application for generate report from Sybase Anywhere. I build it in visual studio 2010 with VB.NET and use rdlc file to display report. I has a receipt printer which connect to PC by serial port.
I want to send image file such bitmap or jpg ...and if possible, i'd like to send pdf file to this printer by click on a button to print directly to printer without show printdialog. I want to send print command directly to printer and without put printer name in code also.
So please kindly to help me. Thank you advanced for all answers.
|
|
|
|
|
You only need the print dialog to allow the user to make choices about which printer to use, paper size, number of copies etc. If you want to do it direct then you just need to set all the relevant parameters in your program. As to driving the printer directly through the serial port, you need to get a copy of the printer's technical documentation to see what commands to send it and what format the data is required to be in, e.g raw, postscript etc.
|
|
|
|
|
I need to be able to book email jobs, and have an app run the jobs on the date and time required.
All my web servers are server 2012 core, with minimum GUI for now.
Back a couple of years ago, I would of just wrote the program as an Windows App.
I was wondering if technology wise and if my skills are good enough, if it's possible to write a windows service that will check a SQL server database for email jobs, and do the work.
I see Windows Store Apps in Visual Studio, but I'm not to sure about it.
I guess a a service, I can't connect to it to query it for data or statistics, and I would have to rely upon the database for that information, so the web application can book the jobs and access the results.
What do you think?
modified 16-Jul-14 13:58pm.
|
|
|
|
|
Yes you can write this as a service or you can write it as a Console application and run it from Scheduled Tasks.
|
|
|
|
|
That was fast!
Thanks for the confirmation.
I'll give the service a try first and see how it goes.
So I guess I am planning this correctly by using the database as a central place to store jobs and results.
Now I can quote the job. Thanks
|
|
|
|
|
Yeah, what Dave said, or do it all within Sql Server -- an agent job that executes an SSIS package.
You'll never get very far if all you do is follow instructions.
|
|
|
|
|
SSIS Package sounds complicated. I need to read up on that first, I did 5 minutes on it just now.
Would that help me with finding the connection string for the SQL Server? since this is a centralized service or console app. And the mail server coordinates.
I guess that's my next question or questions.
Thanks for the confirmation
|
|
|
|
|
jkirkerx wrote: finding the connection string for the SQL Server
It would be running within the Sql Server instance, so that would not be an issue.
jkirkerx wrote: And the mail server coordinates
You can make that configurable.
jkirkerx wrote: SSIS Package sounds complicated
They can be, but what you need may be very simple -- it could be as simple as having it execute a stored procedure in the database.
You'll never get very far if all you do is follow instructions.
|
|
|
|
|
A web-service or a windows-service? The latter should not display a UI.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Windows Service.
I updated my post. Thanks, big difference there.
|
|
|
|
|
Windows-services should work without any user-interaction; they are started when the machine is finished booting, before the user even logs in. There is no user to interact with at that point.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
The Windows Task Scheduler is almost certainly the way to go. Write a console application to check the database, process any outstanding jobs, and then exit. You can then schedule it to run using the schtasks command[^] (or the GUI, if it's available in Server Core).
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
OK.
No argument here, I'll just take your word for it. Seriously.
I bowl, and my bowling couch would tell me to do this or that, and I use to argue with them about it, but now I just accept it and do it.
So I'll takes your years of wisdom on this one.
Thanks!
|
|
|
|
|
Dear experts,
I wonder if everyone could help me to create function for printing bitmap file directly via serial port.
Recently i build a small application for generate report from Sybase Anywhere. I build it in visual studio 2010 with VB.NET and use rdlc file to display report. I has a receipt printer which connect to PC by serial port.
I want to send image file such bitmap or jpg ...and if possible, i'd like to send pdf file to this printer.
So please leave your comment here. Thank you advanced for all answers.
modified 16-Jul-14 6:12am.
|
|
|
|
|
Open the COM port the printer is connected to, preferrably using the communication parameters the printer is expecting, send the data in some format that the printer expects and understands and close the port.
Given the complete lack of detail in your question, like what you're having a difficult time with, it's rather impossible to go into more detail.
|
|
|
|
|
Here is what I have so far
[code] Public Class PokerHands
Sub InputFormat() 'Function to remove space and change characters to UPPER CASE
InputDisplay.Text = InputDisplay.Text.Replace(" ", "").Replace(",","").ToUpper
End Sub
Sub FourOfaKind() 'Four of a Kind
End Sub
Sub ThreeOfaKind() 'Three of a Kind
End Sub
Sub Pair() 'A pair
End Sub
Sub Flush() 'A flush
End Sub
Sub Straight() ' A straight, if ace is low
End Sub
Sub AceStraight() 'An ace-high straight
End Sub
Private Sub InputDisplay_TextChanged(ByVal sender As Object, e As EventArgs) Handles InputDisplay.TextChanged
End Sub
Private Sub Button1_Click(ByValsender As Object, e As EventArgs) Handles Button1.Click
Dim hands(4, 13) As Integer 'Example: If (2,11) = 1 then is JD
Dim SuitsValue() As String = {"S", "D", "C", "H"}
Dim FaceValue() As String = {"2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K", "A"}
End Sub
End Class
[/code]
Hi here is what I have my code so far. I am simply stuck as how to make the program reads the user input and then display the correpsonding deck. For example: if the user input "aH, AS, 2D, 3C, 4C" the program will return ace of hearts, ace of spades, two of diamonds, three of clubs, and four of clubs? Also how can the program will recognize that the first letter (substring (0,1) is the FaceValue and the second letter substring(1,1) is the SuitsValue? I understand I will need a loop function to determine all five. I am sorry if I am asking stupid questions here but I am really stuck!!!
Thank you very much!
|
|
|
|
|
...and the question would be.....?
|
|
|
|
|
Hi, not sure if the posting didn't show all the contents, but my questions is For example: if the user input "aH, AS, 2D, 3C, 4C" the program will return ace of hearts, ace of spades, two of diamonds, three of clubs, and four of clubs? Also how can the program will recognize that the first letter (substring (0,1) is the FaceValue and the second letter substring(1,1) is the SuitsValue? I understand I will need a loop function to determine all five. I am sorry if I am asking stupid questions here but I am really stuck!!!
Thank you very much!
|
|
|
|
|
Most of this depends on how you're representing your cards, but...
First, get rid of that replace where you remove all the commas. You'll need them to split the string with.
string[] cardSpecifiers = InputDisplay.Text.Split(new string[] { "," }, System.StringSplitOptions.RemoveEmptyEntries);
Then it's a simple matter of iterating over the returning array of strings and parsing each for a card value and suit.
for (int i = 0; i < cardSpecifier.Length; i++)
{
cardValues[i] = cardSpecifiers[i].SubString(0, 1);
cardSuits[i] = cardSpecifiers[i].SubString(1,1);
}
|
|
|
|
|
Hi, but what I don't get is how to make the program reads the user input "InputDisplay" and then display the corresponding string from the array SuitsValue and FaceValue to the listbox "OutputDisplay". For example: if the user input "aH, AS, 2D, 3C, 4C" the program will return ace of hearts, ace of spades, two of diamonds, three of clubs, and four of clubs, the value that is stored in the arrays? Also how can the program will recognize that the first letter (substring (0,1) is the FaceValue and the second letter substring(1,1) is the SuitsValue?
|
|
|
|
|
I'm not walking you through your entire program. I've got my own 150,000 line monster to deal with full time right now.
The SubString calls will return single characters from your card specification strings. What you do with that characters is up to you. You could have a Dictionary<string, string=""> to return a full name based on the character you get back, like this:
Dim cardValueNames = New Dictionary(Of String, String)
cardValueNames.Add("a", "Ace")
cardValueNames.Add("k", "King")
cardValueNames.Add("q", "Queen")
Debug.WriteLine(cardValueNames("k"))
It sounds like you REALLY need to get a beginners book in C# and work through it.
|
|
|
|
|
Yes I am a very beginner in VB.NET and I thought this is a Visual Basic forum.....
|
|
|
|
|
My bad. It is the VB.NET forum. In either case, the book recommendation still stands.
|
|
|
|
|
I actually have 2 questions
I added an imagelist to my listview, and it always add the first image in the list to the first column.
I can eliminate the image, but it always leave a space for the image before the text, changing my aligment from left to sort of right.
Is there a way to override this?
Dim item1 As New ListViewItem(sJC(idx).FINVNO.ToString)
item1.Checked = False
item1.SubItems.Add(sJC(idx).FCUSTNO)
item1.SubItems.Add(sJC(idx).FTRANSDATE)
item1.SubItems.Add(sJC(idx).FTRANSTIME)
item1.SubItems.Add(sJC(idx).FCOMPANY)
item1.SubItems.Add(sJC(idx).FCONTACT1)
item1.SubItems.Add(sJC(idx).FEMAIL1)
item1.SubItems.Add("")
item1.SubItems.Add("")
lv_journal_icons.Items.Add(item1)
Question 2:
I used some code that extends the listview so you can add an icon or image to a subitem.
It adds the image, but I want to center the image in the column
So the code sends a message to the pump setting the cell.
I've done some c++ with listview, but I can't remember if I can send a message to the pump to center the image.
Public Sub AddIconToSubitem( _
ByVal row As Integer,
ByVal col As Integer,
ByVal icon_num As Integer)
Dim lvi As New ListViewWithIcons.LV_ITEM()
lvi.iItem = row ' Row.
lvi.iSubItem = col ' Column.
' Indicate what we're setting.
' lvi.mask = ListViewWithIcons.LVIF_IMAGE Or
' ListViewWithIcons.LVIF_TEXT
lvi.mask = ListViewWithIcons.LVIF_IMAGE
' Image index in the ImageList.
lvi.iImage = icon_num
' Send the LVM_SETITEM message.
ListViewWithIcons.SendMessage(Me.Handle, ListViewWithIcons.LVM_SETITEM, 0, lvi)
End Sub
I looked at the structure for LVITEM, and didn't see anything for alignment.
Public Structure LV_ITEM
Public mask As UInt32
Public iItem As Int32
Public iSubItem As Int32
Public state As UInt32
Public stateMask As UInt32
Public pszText As String
Public cchTextMax As Int32
Public iImage As Int32
Public lParam As IntPtr
End Structure
Queston3:
Is it default behavior for the listiew to resize the image large, I made my image 16x16 but it always displays larger.
|
|
|
|
|