darkshark Posted December 10, 2014 Posted December 10, 2014 (edited) Hi, everybody! i'm trying to make a math worksheet generator for kids, but i need it in this format: and generate a PDF file with the math problems.... i know how to generate a problems, but idk how to 'format' this anyone have a ideia how to make this? Thanks a lot. p.s: Here is my sum generator code: Func _Sum_Generator($iMin, $iMax, $iProblems = 100, $iMaxAddends = 2, $bRandomAddends = True, $bUseDecimal = False, $bUseNegative = False) Local $aGenerated[$iProblems][2] If $iMaxAddends < 2 Then $iMaxAddends = 2 For $i = 0 To $iProblems -1 $aGenerated[$i][1] = 0 $iAddends = $iMaxAddends -1 If ($bRandomAddends And $iMaxAddends > 2) Then $iAddends = Random(2, $iMaxAddends, 1) -1 For $j = 0 To $iAddends Local $iOnlyInt = 1, $Negative = 0 If $bUseDecimal Then $iOnlyInt = Random(0,1,1) If $bUseNegative Then $Negative = Random(0,1,1) Local $iRandom = Round(Random($iMin, $iMax, $iOnlyInt), 2) If $Negative Then $iRandom *= -1 If $j = $iAddends Then $aGenerated[$i][0] &= String($iRandom) & " = " Else $aGenerated[$i][0] &= String($iRandom) & " + " EndIf $aGenerated[$i][1] += $iRandom Next Next Return $aGenerated EndFunc Edited December 10, 2014 by darkshark
Moderators JLogan3o13 Posted December 10, 2014 Moderators Posted December 10, 2014 Why not look at the built in Word features in the help file? Word allows you numerous formatting styles, almost all of which you can control via your script. Then when you're done, you can use the Office engine to save as a PDF (or print to PDF if you have a PDF printer installed). "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
darkshark Posted December 12, 2014 Author Posted December 12, 2014 I tried to use what you recommended but idk how to add a equation in word using autoit... =/
Jfish Posted December 13, 2014 Posted December 13, 2014 I think the math equations are accessible via the oMath interface but I did not see a ton of examples out there on how to use it ... http://msdn.microsoft.com/en-us/library/office/Microsoft.Office.Interop.Word%28v=office.15%29.aspx Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt
Jfish Posted December 13, 2014 Posted December 13, 2014 Here is an example that I got to work: #include <Word.au3> $oWord=_Word_Create ( ) _Word_DocAdd($oWord) Dim $objRange; As Range Dim $objEq; As OMath $objRange = $oWord.Selection.Range $objRange.Text = "Celsius = (5/9)(Fahrenheit – 32)" $objRange = $oWord.Selection.OMaths.Add($objRange) $objEq = $objRange.OMaths(1) $objEq.BuildUp I adopted it from this page. It is a very cool interface - I did not realize you could do that. Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now