Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Charts from Alpha data - another take

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Charts from Alpha data - another take

    After reading the recent post concerning the difficulties with generating a bitmap from Alpha data in the style of a chart and printing same, I thought there might be another way. Suppose you export the data you want to an excel file and use excel to create and print the chart.

    This function assumes you have exported some values from a table to excel. It opens the spreadsheet, decides what the active area is, selects that area, writes a macro which will chart the selected data, prints the chart, closes the spreadsheet without changing anything. I have only tested with a simple two column spreadsheet, thus far. If anyone is interested in further development I will be glad to revisit it. I don't use charting much myself.

    To experiment with the function just create a new spreadsheet with some values in columns A and B. A simple sample attached.

    Code:
    FUNCTION new_chart AS C (excelname AS C)
    	Dim xlApp as p
    	Dim myCell as c
    	xlApp = ole.create("Excel.Application")
    	xlApp.Workbooks.Open(excelname)
    	'xlApp.Visible = .T. 'comment this line out if you don't want to see Excel
    	xlapp.DisplayAlerts = .F.
    	'establish last row value
    	lastrow = xlApp.Activecell.SpecialCells("11").Row
    	lastcol = xlApp.Activecell.SpecialCells("11").Column
    	lastcell = chr(lastcol+64)+lastrow
    	xlApp.Range("A1:"+lastcell).Select()
    	'Create a module in the Excel Project section.
    	dim vbext_ct_StdModule as n
    	vbext_ct_StdModule = 1 'VBEXT constant
    	xlApp.VBE.ActiveVBProject.VBComponents.Add(vbext_ct_StdModule)' Create a module in the Excel project environment.
    	
    	dim VBComp as P
    	'Assumption is made that there is no Module1 in the empty Excel file.
    	'If created the module is always named "Module1"
    	VBComp = xlApp.VBE.ActiveVBProject.VBComponents.Item("Module1")
    	
    	'Now write the macro into Excel. Code presentation is simple for faster a "AH Erlebnis".
    	VBComp.CodeModule.InsertLines(1,"Public Sub Prt_chart()")
    	VBComp.CodeModule.InsertLines(2,"'This code is created with Alpha Five")
    	VBComp.CodeModule.InsertLines(3,"Charts.Add")
    	VBComp.CodeModule.InsertLines(4,"ActiveChart.ChartType = xlColumnClustered")
    	VBComp.CodeModule.InsertLines(5,"ActiveChart.SetSourceData Source:=Sheets("+quote("Sheet1")+").Range("+quote("A1:"+lastcell)+"), PlotBy:=xlColumns")
    	VBComp.CodeModule.InsertLines(6,"ActiveChart.Location Where:=xlLocationAsObject, Name:="+quote("Sheet1"))
    	VBComp.CodeModule.InsertLines(7,"With ActiveChart")
    	VBComp.CodeModule.InsertLines(8,".HasTitle = True")
    	VBComp.CodeModule.InsertLines(9,".ChartTitle.Characters.Text = "+quote("Some Title"))
    	VBComp.CodeModule.InsertLines(10,".Axes(xlCategory, xlPrimary).HasTitle = True")
    	VBComp.CodeModule.InsertLines(11,".Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "+quote("X axis title"))
    	VBComp.CodeModule.InsertLines(12,".Axes(xlValue, xlPrimary).HasTitle = True")
    	VBComp.CodeModule.InsertLines(13,".Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "+quote("y axis title"))
    	VBComp.CodeModule.InsertLines(14,"ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True")
    	VBComp.CodeModule.InsertLines(15,"End With")
    	VBComp.CodeModule.InsertLines(16,"End Sub")
    	
    	'Now run the macro that was created by Alpha- and VBA-code.
    	xlApp.Application.Run("Prt_chart")
    	xlApp.Workbooks.Close()
    	xlapp.DisplayAlerts = .T.
    	xlApp.Quit()
    END FUNCTION
    
    'to call the function, use the example on the next line
    'new_chart("c:\excelfilename.xls")

    Thanks as always to John Magno for the original Excel routine and Marcel Kollenaar for his macro generation instruction.
    Last edited by Stan Mathews; 10-25-2006, 12:23 PM. Reason: kudos
    There can be only one.

    #2
    Re: Charts from Alpha data - another take

    Stan,

    Nice! :)
    Marcel

    I hear and I forget. I see and I remember. I do and I understand.
    ---- Confusius ----

    Comment


      #3
      Re: Charts from Alpha data - another take

      The line which 'Create a module in the Excel project environment':

      xlApp.VBE.ActiveVBProject.VBComponents.Add(vbext_ct_StdModule)'

      gives an error saying property not found and subblement not found...
      Last edited by coastal; 04-11-2007, 11:47 PM.

      Comment


        #4
        Re: Charts from Alpha data - another take

        Originally posted by coastal View Post
        The line which 'Create a module in the Excel project environment':

        xlApp.VBE.ActiveVBProject.VBComponents.Add(vbext_ct_StdModule)'

        gives an error saying property not found and subblement not found...
        Not here it doesn't. What version of windows/office/excel are you using?
        There can be only one.

        Comment


          #5
          Re: Charts from Alpha data - another take

          same error here Stan, Windows XP professional service pack 2; Excel 2003 SP2

          Comment


            #6
            Re: Charts from Alpha data - another take

            Originally posted by Lance Gurd View Post
            same error here Stan, Windows XP professional service pack 2; Excel 2003 SP2
            I had forgotten to mention a couple of settings you have to make in excel to let the macro be created and run. Accessed from the Tools, Macro, Security menu.
            Last edited by Stan Mathews; 04-12-2007, 10:35 AM.
            There can be only one.

            Comment


              #7
              Re: Charts from Alpha data - another take

              Thanks Stan, that now works. To be honest I had downloaded your example and code when first uploaded and thought I would look at it later. Coastal prompted that retry.

              Did wonder why could see a chart forming on screen then closing and nothing else happening for a while, till I read the code and your description again. Then went to the system printer and found the print outs!!!

              Moral - Fools jump in!!!

              But as Marcel said very nice and it also gives a good insite to what can be done with OLE

              Comment


                #8
                Re: Charts from Alpha data - another take

                Originally posted by Lance Gurd View Post
                Thanks Stan, that now works. To be honest I had downloaded your example and code when first uploaded and thought I would look at it later. Coastal prompted that retry.

                Did wonder why could see a chart forming on screen then closing and nothing else happening for a while, till I read the code and your description again. Then went to the system printer and found the print outs!!!

                Moral - Fools jump in!!!

                But as Marcel said very nice and it also gives a good insite to what can be done with OLE
                Glad you got it going. I use the ole functions quite a bit. Almost no reports any more for me. Spit the data out to a spreadsheet, format it, then email it.

                Users can copy and paste into other spreadsheets, documents, etc.
                There can be only one.

                Comment


                  #9
                  Re: Charts from Alpha data - another take

                  Great it works! Its really amazing and powerful! Thank you Stan

                  Can u please advise me how I can learn OLE and how I can output into line graph instead and save it as a bitmap somewhere and then using that bitmap as reference to a place holder on report! I wanted it all to work in alpha reports itself but that is just going no where*, so I thought of doing this method and saving to bitmap so i can link the image of graph into a report...so cumbersome just to get a graph into alpha....

                  i would like to explore the options availale for this line:
                  VBComp.CodeModule.InsertLines(4,"ActiveChart.ChartType = xlColumnClustered")

                  how can i view ActiveChart.ChartType options? perhaps this will be a more directed ? that way


                  Much appreciated. Thank you for the help.

                  *going nowhere as in i have tried simplecharts and using MS office chart activex its great on forms but no luck getting it to work on reports....

                  i also understand and respect Alpha policies stating that this is not the place to ask for help and I have initiated a thread in teh appropriate place for this so if anyone can please help me out here

                  by the way, i get this error when i do charting with more than 55 records: please find attached:
                  Last edited by coastal; 04-12-2007, 09:51 PM.

                  Comment


                    #10
                    Re: Charts from Alpha data - another take

                    sweet, "xlLineStacked" did the job for me and GOT all the errors FIXED!~ YAY! but now...how to save just the graph as an image....hmmm...if only i could just save the image as bmp or jpg...
                    Last edited by coastal; 04-12-2007, 10:15 PM.

                    Comment


                      #11
                      Re: Charts from Alpha data - another take

                      Originally posted by coastal View Post
                      sweet, "xlLineStacked" did the job for me and GOT all the errors FIXED!~ YAY! but now...how to save just the graph as an image....hmmm...if only i could just save the image as bmp or jpg...
                      You could print to a pdf creation print driver instead of the system printer. Would a pdf "image" serve your purposes? Something like

                      xlApp.Application.ActivePrinter = "PDF995 on Ne00:"

                      should redirect the output.

                      Actually you need to change the macro line ...

                      Code:
                      	VBComp.CodeModule.InsertLines(14,"ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= "+quote("PDF995 on Ne00:")+", Collate:=True")
                      Last edited by Stan Mathews; 04-13-2007, 09:48 AM.
                      There can be only one.

                      Comment


                        #12
                        Re: Charts from Alpha data - another take

                        Hey there! thanks for your input. The reason I am doing an image is so that I can up it into an alpha report as an addition to where there is other data also. so a pdf would not work in that respect. trying to think what other options i have. the image that alpha report takes must be bmp, png, or a jpg. hmmm...tryin to think...

                        Comment


                          #13
                          Re: Charts from Alpha data - another take

                          Originally posted by coastal View Post
                          Hey there! thanks for your input. The reason I am doing an image is so that I can up it into an alpha report as an addition to where there is other data also. so a pdf would not work in that respect. trying to think what other options i have. the image that alpha report takes must be bmp, png, or a jpg. hmmm...tryin to think...

                          This thread may be of help. I found it by searching on 'image report' (without the single quotes).
                          Tim Kiebert
                          Eagle Creek Citrus
                          A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                          Comment

                          Working...
                          X