Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3279266
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:34:24+00:00 2026-05-17T19:34:24+00:00

i hav a tabular forms used to generate reports which are html files and

  • 0

i hav a tabular forms used to generate reports which are html files and i want to save these files by filling with data dynamically using obj-c..

any ideas how to do ..

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:34:24+00:00Added an answer on May 17, 2026 at 7:34 pm

    I do a lot of this. My best friend here is NSString & Co.

    Take a special look at the method stringWithFormat.

    For example, here is me setting colors for an html table.

    -(NSString *) colorcomponents:(int) i size:(int) s
    {
        CGColorRef color = [[coltable objectAtIndex:i] CGColor];
        NSString * tablecompformat = @"<td style=\"background: rgb(%d, %d, %d)\" width=%d height=%d> <b>  </b>  </td>";
        int numComponents = CGColorGetNumberOfComponents(color);
    
        if (numComponents == 4)
        {
            const CGFloat *components = CGColorGetComponents(color);
            CGFloat red = components[0]*256;
            CGFloat green = components[1]*256;
            CGFloat blue = components[2]*256;
    
            return [NSString     stringWithFormat:tablecompformat,(int)red,(int)green,(int)blue,s,s];
        }
        return nil;
    }
    

    For each of the pieces you build you can add to your main html string using the NSString method appendString. After you have finished building your string you cah save it as a file or eamil it or whatever…

    Here is the main routine. It should give you a good idea of how to dynamically build and html string:

    -(NSString *) emailstr
    {
        NSMutableString * ress=[[NSMutableString alloc] initWithCapacity:100];
    
        NSString * formatstring=@"<tr><td > <b> %@</b>  </td>  <td>: %@ </td></tr>\n";
        //NSString * formatstring2=@"<tr><td> <b> %@</b>  </td>  <td>: %@ </td> <td>: %@ </td> </tr>\n";
        NSString * hline=@"<tr><td colspan=\"3\">  <hr>  </td>  </tr>\n";
    
        [ress appendString:@"<html><body>\n"];
        [ress appendString:[NSString stringWithFormat:@"<h3> Game: %@ </h3> \n", [gm name]  ]];
    
        [ress appendString:@"<table border=\"0\">"];// beginning of main table
        [ress appendString:@"<tr><td > <b> Initial</b>  </td> <td>"];
    
        [ress appendString:@"<table border=\"0\">"];
        for (int i=0;i<[gm xcount];i++)
        {
            [ress appendString:@"<tr> "];
            for(int j=0;j<[gm ycount];j++)
            {
                int k=[gm getinitpos:i y:j];
                [ress appendString:[self colorcomponents:k size:10]];
            }
            [ress appendString:@"</tr> "];
        }
        [ress appendString:@"</table><br>\n "];
        [ress appendString:@"</td></tr>\n"];
    
        [ress appendString:@"<tr><td> <b> End</b>  </td> <td>"];
        [ress appendString:@"<table border=\"0\">"];
        for (int i=0;i<[gm xcount];i++)
        {
            [ress appendString:@"<tr> "];
            for(int j=0;j<[gm ycount];j++)
            {
                int k=[gm getpos:i y:j];
                [ress appendString:[self colorcomponents:k size:10]];
    
            }
            [ress appendString:@"</tr> "];
        }
        [ress appendString:@"</table><br>"];
        [ress appendString:@"</td></tr>\n"];
    
    
        [ress appendString:[NSString stringWithFormat:formatstring,@"Rules",[sql getrulesname:[gm rules_id]]]];
        if ([gm step]>0) 
        {
            //[ress appendString:@"<table border=\"0\">"];
            [ress appendString:hline]; 
    
            for (int i=1; i<=[gm step];i++)
            {
                int x=[sql getlogx:[gm session_id] step:i];
                int y=[sql getlogy:[gm session_id] step:i];
    
                NSString * pnum = [NSString stringWithFormat:@"Move %d",i];
                NSString * posstring=[NSString stringWithFormat:@"(%d, %d)",x+1,y+1 ];
                [ress appendString:[NSString stringWithFormat:formatstring,pnum,posstring]];
            }
            [ress appendString:hline];
            //[ress appendString:@"</table><br>"];
        }
    
        [ress appendString:@"</table><br>"]; //end of main table
    
        [ress appendString:@"</body></html>"];
    
        return ress;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i hav an html file which displays table view ,how to load this on
i hav a html tags stored in string and i want to load the
i hav a file with some data and i want to attach this file
I hav codes eg1.py , eg2.py , eg3.py eg3.py imports eg2.py which in turn
I hav to save the values of NSUserDefault to the Array,and later on have
i hav removed items from tool bar,but i want to re add it at
I hav a string e.g. 2010-09-24 . Now I want this string read as
I hav a programme, which must work differently for linuxthreads and nptl. Are there
i hav a two dates of type nsdate and i want to calculate the
i hav String date & i want to inceament date by 1 & it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.